The following query generates a "syntax error near '=' in the CAST([Transaction].Time AS Date) = @TransTime" function;
declare @TransTime as date = :TransTime
declare @TransTime2 as date = :TransTime2
SUM(CASE WHEN [Transaction].CashierID = 4
THEN [Transaction].Total ELSE 0 END) AS Bill
CAST([Transaction].Time AS Date) = @TransTime
CAST([Transaction].Time AS Date) = @TransTime2
The CAST AS Date works using a single date but adding the BETWEEN, AND functions for a second CAST AS Date function creates the error. I must be doing something wrong in attempting to query between two dates but I cannot figure why, any help would be greatly appreciated.