I have a query that selects the Min of BillingStartDate and the Max of BillingEndDate.
In the same query, I determine if the BillingEndDate is Greater than the BillingStartDate and denote it as OK, else Error.
I need to modify the query to determine if the Min BillingEndDate is Greater than the Max BillingStartDate and denote it as OK, else Error.
Following is the query. Thanks for any help.
Code:
SELECT dbo_SI_Main.MachineId, Min(dbo_SI_Main.BillingStartDate) AS MinOfBillingStartDate, Max(dbo_SI_Main.BillingEndDate) AS MaxOfBillingEndDate, IIf([BillingEndDate]>[BillingStartDate],"OK","Error") AS ErrorOrOK
FROM dbo_SI_Main
GROUP BY dbo_SI_Main.ConfigurationId, IIf([BillingEndDate]>[BillingStartDate],"OK","Error")
HAVING (((dbo_SI_Main.ConfigurationId)="123456"))
ORDER BY Min(dbo_SI_Main.BillingStartDate) DESC;