Reputation: 149
I have two tables:
SELECT DISTINCT ServLine,RoomID,StartDt,EndDt
INTO #raw
FROM table
SELECT CALENDAR_DATE
INTO #cal
FROM caldendar
How would I write a query to show each CALENDAR_DATE from the #cal table that is in between each StartDt and EndDt for each RoomID and ServLine from the #raw table.
Thank you
Upvotes: 2
Views: 112
Reputation: 38053
With a join. Depending on exactly what input and desired output you have, the join may vary, but an inner join
seems like a good place to start without more information.
select *
from #raw r
inner join #cal c
on c.date >= r.startdt
and c.date <= r.enddt
Upvotes: 2