I am new to SQL coding and I am encountering only one error code so far.
At the second line WHEN CONVERT
:
(rd.254
is my table date column)
CASE WHEN CONVERT(date,rd.F254) Between
CONVERT(date,getdate()-7) AND CONVERT(date, getdate()-1) THEN rd.F64 END AS QtyLastWeek
WHEN CONVERT(date,rd.F254) <= CONVERT(date,getdate()-8) THEN rd.F64 END AS Qty2WeeksAgo
I am trying to find and fix the syntax.
you have missing comma and case
There is incorrect syntax. If you want to select 2 columns
QtyLastWeek
andQty2WeeksAgo
you have to use the comma afterQtyLastWeek
and use anotherCASE
expression.You are missing
case
keyword in the second case statement. Try this !