Hi All,
I'm getting a sql error below when try to run the query. I added the TypeCount and it works but when I added code in red I get the sql error. I'm trying to get the RepairCount so all with the same ToolID and with the word "repair" in its loc. Loc data looks like gc-ddo, gc-ddo-repair, etc. so I only want to count the ones where it finds the word repair.
Server: Msg 156, Level 15, State 1, Line 10
Incorrect syntax near the keyword 'as'.
Thanks in advance for your help!Code:SELECT TOP 100 PERCENT EQNumber, Status, TStatus, SStatus, JobEndDate, DStatus, Loc, ToolID, TechID, NewRigPartner, SupEQ, (SELECT COUNT(EQNumber) FROM tblEQStatus B WHERE A.ToolID = B.ToolID) as TypeCount (SELECT COUNT(EQNumber) FROM tblEQStatus B WHERE A.ToolID = B.ToolID and B.Loc like '%repair%') as RepairCount FROM tblEQStatus A ORDER BY Status



LinkBack URL
About LinkBacks

Bookmarks