sql7 what's wrong with this statement?

Posted on 2005-04-19
Last Modified: 2010-03-19
I'm running this in SQL Query Analyzer. I've trimmed it down to a very basic version but I'm still getting the same error:

select callid
from (
   select callid, callopr
   from hdwcall
   where status = 'open'

Server: Msg 170, Level 15, State 1, Line 6
Line 6: Incorrect syntax near ')'.
Question by:alanbergin
    LVL 23

    Accepted Solution

    You need to give the nested query an alias:

    select callid
    from (
       select callid, callopr
       from hdwcall
       where status = 'open'
    ) SomeTable

    Author Comment

    Nice one. Thank you!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
    Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now