Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Merge Contents of two tables using a date range in the logic

$
0
0

Are  joins involving date ranges possible when merging?

 

I have two data sources that will help me count the number of business days between a single appointment's [Appt Made Date] and [Appt Visit Date]

Table 1. Scheduled Appts: [Appt Key], [Appt Made Date], [Appt Visit Date]

Table 2. Date Dimension: [Date], [Holiday Flag], [Weekend Flag]

 

Ideally I want to merge these two data sources like so

Select

S.[Appt Key], Count(D.Date)

FROM Scheduled Appts S

LEFT OUTER JOIN Date Dimension D ON D.[DATE] BETWEEN S.[Appt Made Date] AND S.[Appt Visit Date]

WHERE  [Holiday Flag] IS NULL AND [Weekend Flag] IS NULL

GROUP BY S.[Appt Key]

 

Is something like that allowed with merging or appending?


Viewing all articles
Browse latest Browse all 213819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>