Feb 06 2023 08:48 AM
I have a query. Trying to count workdays between two dates in fact table. in dimDate workdayFlag = 1 for true and 0 for false.
select
PO_Item,
Receipt_date,
Promissed_date,
(select sum(workdayFlag) from dimDate where Cal_date between receipt_date and Promissed_date) as 'dayVariance'
from factPO
this seems to work but am wondering if this could be written by joining factPO and dimDate. An inline query seems expensive if my result set is in the millions of records.
select
from factPO join dimDate on
Feb 08 2023 09:01 PM
SolutionFeb 08 2023 09:01 PM
Solution