The query below ran just fine in Excel against an Access Database, but now trying to run on a SQL database it fails with this message. (script error near =. Upon research the line of code that has the issue is "SELECT Sum(iif(backorder_qty=0,SO_Detail.Total_Price,backorder_qty*unit_cost)) AS 'Open Sales Orders - MONTH'". For if I remove the 'Open Sales Orders - MONTH'" it runs fine.
Query:
SELECT Sum(iif(backorder_qty=0,SO_Detail.Total_Price,backorder_qty*unit_cost)) AS 'Open Sales Orders - MONTH'
FROM `\\account-win2k10\JobBOSS Server\Database\jobboss`.Customer Customer, `\\account-win2k10\JobBOSS Server\Database\jobboss`.SO_Detail SO_Detail, `\\account-win2k10\JobBOSS Server\Database\jobboss`.SO_Header SO_Header
WHERE SO_Header.Customer = Customer.Customer AND SO_Detail.Sales_Order = SO_Header.Sales_Order AND ((SO_Detail.Status='open') AND (so_detail.promised_date-ship_lead_days Between ? And ?) AND (SO_Detail.Sales_Code='sales-molded') OR (SO_Detail.Status='backorder') AND (so_detail.promised_date-ship_lead_days Between ? And ?) AND (SO_Detail.Sales_Code='sales-molded'))
Query:
SELECT Sum(iif(backorder_qty=0,SO_Detail.Total_Price,backorder_qty*unit_cost)) AS 'Open Sales Orders - MONTH'
FROM `\\account-win2k10\JobBOSS Server\Database\jobboss`.Customer Customer, `\\account-win2k10\JobBOSS Server\Database\jobboss`.SO_Detail SO_Detail, `\\account-win2k10\JobBOSS Server\Database\jobboss`.SO_Header SO_Header
WHERE SO_Header.Customer = Customer.Customer AND SO_Detail.Sales_Order = SO_Header.Sales_Order AND ((SO_Detail.Status='open') AND (so_detail.promised_date-ship_lead_days Between ? And ?) AND (SO_Detail.Sales_Code='sales-molded') OR (SO_Detail.Status='backorder') AND (so_detail.promised_date-ship_lead_days Between ? And ?) AND (SO_Detail.Sales_Code='sales-molded'))