I am struggling to see what is wrong with this SQL statement. By the errors it seems to have an issue with the pareths, although I am not sure what alternative I have.
the errors are:
the errors are:
Code:
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '>'.
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near 'ladetail'.
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near 'ladetail'.
Code:
SELECT ladetail.fdate,ladetail.fshift,ladetail.fcompqty,ladetail.fscrpqty,[fcompqty]+[fscrpqty] AS Qty,ladetail.fpro_id,ladetail.fempno,inrtgs.fuprodtime,inrtgs.fsetuptime,
jomast.fquantity,[fsetuptime]/[fquantity] AS [Aloc Setup],([Aloc Setup]+[fuprodtime])*IIf(([fcompqty]+[fscrpqty])>[fquantity],[fquantity],([fcompqty]+[fscrpqty]) AS [Earned Hr]
FROM ladetail INNER JOIN (jomast INNER JOIN inrtgs ON jomast.fpartno = inrtgs.fpartno) ON (ladetail.foperno = inrtgs.foperno) AND (ladetail.fjobno = jomast.fjobno)
WHERE (((ladetail.fdate)=Date()-1) AND ((ladetail.fshift)="1" Or (ladetail.fshift)="2") AND (([fcompqty]+[fscrpqty])>0) AND ((ladetail.fpro_id) In
("BAR") OR (((ladetail.fdate)=Date()-2) AND
((ladetail.fshift)="3") AND (([fcompqty]+[fscrpqty])>0) AND ((ladetail.fpro_id) In ("BAR")