Closed Thread
Results 1 to 3 of 3

Thread: SQL2000 Incorrect syntax

  1. #1
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    SQL2000 Incorrect syntax

    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'.

    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
    
    Thanks in advance for your help!

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    You need a comma after "as TypeCount"
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #3
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Thanks, I didn't see it.

Closed Thread

Similar Threads

  1. Create view sql2000
    By Rebelle in forum Microsoft SQL Server
    Replies: 5
    Last Post: April 16th, 2009, 09:23 AM
  2. incorrect syntax
    By todd2006 in forum ASP Development
    Replies: 5
    Last Post: February 13th, 2009, 12:55 PM
  3. Update Syntax
    By PhloooooIsFlo in forum SQL Development
    Replies: 4
    Last Post: November 21st, 2008, 10:58 AM
  4. New Syntax Highlight BBCode
    By jmurrayhead in forum Announcements
    Replies: 0
    Last Post: October 28th, 2008, 09:44 PM
  5. syntax
    By Shem in forum .NET Development
    Replies: 1
    Last Post: July 9th, 2008, 06:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO