View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dchow dchow is offline
external usenet poster
 
Posts: 18
Default Question about IIF in SQL query

I was trying to send a SQL query using ODBC to fill my worksheet with
some invoice information. In the Amount field I want it to be in
negative if the doc type is RETURN. So I did:

Select DOCNUM as Document,
DOCDATE as DocDate,
IIF(DOCTYPE="RET", -DOCAMT, DOCAMT) as Amount
From TableName

I was complaining about SQL syntax error. If I removed the IIF line
it worked fine. Does SQL support IIF?