Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Can multiple joins be avoided for the same table? - response (6) by dnoeth

$
0
0

That's a variation of the common problem "how many working days were needed to process this task":
Add a new SMALLINT column to your calendar table like holiday_seqnum and populate it once with a running number using
SUM(case when weekend then 1 else 0 end) over (order by calendardate rows unbounded preceding).
Now it's two joins to your calendar and a simple difference of the holiday_seqnums of Resignation_Date and Joining_Date.
Of course you might do the same for working days or simply do number of days between star end end minus number of holidays:-)
 
Dieter


Viewing all articles
Browse latest Browse all 14773

Trending Articles



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