I have two queries
Query 1 : Retrieves last two end of month date from Date Dimension output as
Query 2 : Uses a Date field in a where clause…
E.g. All the data at Date D1.
How can I use the output of query 1 recursively in query 2 so that
The combined output should be
Select * from Query2 where ActualDate= "28-02-2019" Union all All Select * from Query2 where ActualDate= "30-01-2019" (Date should come from the Query1)
Any help would be much appreciated.
Query 2 is as below:
SELECT SL.InvoiceID, sum(SL.Balance) AS Balance,FROM FactableBalance AS SLINNER JOIN DateDimension AS DT1 ON DT1.ActualDate = ‘2019-02-28 00:00:00.000’WHERE SL.LedgerAccountType = ‘Credit’ AND DT1.ID >= BalanceOpenDateID AND DT1.ID < BalanceCloseDateIDGROUP BY SL.InvoiceID