Thanks!
It's very helpfull when you too get som documentation, the articles was interesting.
At the time beeing, I have ended up with:
select RTRIM(C.per_fornavn)+' '+RTRIM(C.per_efternavn) As Employee, A.dato from dbo.dutyrostershift A
INNER Join dbo.vacation B ON A.dato BETWEEN CONVERT(datetime,B.start-36163,105) AND Convert(datetime,B.fld_end-36163,105)
JOIN dbo.vacation D ON D.personalid = A.employeeid
Join DBO.PERSONAL C ON A.employeeid = C.per_personal_id
where A.shifttype = 1 AND D.Wish_Vacation = 1
Order by C.per_personal_id, A.dato
The reason for the two joins to dbo.vacation is to make the where clause work. First time i have used a double join!
I only have one problem left - It shows multible answers for each record.
Say, that emploeee Edvard Korsbæk has wished vacation on 2013.11.13 - that gives one record in dutyrostershift.
But i get from 4 to 12 correct answers on this.
It has something to do with the joins - I Think I know that - But 'How to' only show once?
If i change the first line to:
select RTRIM(C.per_fornavn)+' '+RTRIM(C.per_efternavn) As Employee, A.dato, A.ID from dbo.dutyrostershift A
I only want to show one line for each A.ID
How to?
Best regards
Edvard Korsbæk