Hi,
Could someone please help me with the correct way to use an If statement to pull data into Excel via Microsoft Query (ODBC connection)
I need if a certain column is a number 2, then convert the result to a negative, if not then normal result
No matter which way I do the formula I end up with a Syntax Error, so I'm obviously missing something.
Thanks
Could someone please help me with the correct way to use an If statement to pull data into Excel via Microsoft Query (ODBC connection)
I need if a certain column is a number 2, then convert the result to a negative, if not then normal result
SQL:
SELECT invoicedetailproduct.internaldocnum, IIF(invoiceheader.doctype=2, invoicedetailproduct.taxableamt*-1, invoicedetailproduct.taxableamt)
FROM admin.invoicedetailproduct invoicedetailproduct, admin.invoiceheader invoiceheader
WHERE invoiceheader.internaldocnum = invoicedetailproduct.internaldocnum
No matter which way I do the formula I end up with a Syntax Error, so I'm obviously missing something.
Thanks