View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andy Andy is offline
external usenet poster
 
Posts: 414
Default Using a CASE statement in another spreadsheet?

Hi,
I'm selecting from another spreadsheet via ODBC, and want to use a CASE
function in the select statement, to short cut some summing up.

Is something like this possible (heres a cut down version)?
SELECT ActualApr05, case when ActualApr05 <0 then ActualApr05 else 0 end as
QT105 FROM forecastcosts

The statement above returns the following error:
[Microsoft][ODBC Excel Driver] Syntax error (missing operator) in query
expression 'case when ActualApr05 <0 then ActualApr05 else 0 end'.

Any ideas?
Many thanks in advance