I am trying to do a CASE statement from a query into Excel. This operation works fine if I am trying to do a comparison on a text field but fails when trying to perform on a date field.
For instance, if I do:
then I get a list of Traffic/Not Traffic
If however I try to run:
then i get an error "Didn't expect VoidDate after the SELECT column List".
I have tried all variations of date formats I can think of:
mm/dd/yyyy
yyyy-mm-dd
yyyy/m/d
m/d/yyyy
have used ' and "
nothing I have done has made the case statement valid.
Any suggestions?
Thanks,
Leslie
Leslie
For instance, if I do:
Code:
SELECT Case When CasPre <> 'TR' then 'Not Traffic' else 'Traffic' end From TableName
If however I try to run:
Code:
SELECT Case When VoidDate > '1900-01-00' then VoidDate else '' end From TableName
then i get an error "Didn't expect VoidDate after the SELECT column List".
I have tried all variations of date formats I can think of:
mm/dd/yyyy
yyyy-mm-dd
yyyy/m/d
m/d/yyyy
have used ' and "
nothing I have done has made the case statement valid.
Any suggestions?
Thanks,
Leslie
Leslie