Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2002
    Posts
    229

    Unanswered: Subselect in From

    Is this syntax not supported by SQL Server 2000...?

    select count(*) from (select useridentifier from registered_users
    where useridentifier < -120)

  2. #2
    Join Date
    Jun 2003
    Posts
    269
    this is the correct query
    Code:
    select count(*) from (select useridentifier from registered_users 
    where useridentifier < -120) as temp
    I love cursor,though I never use it.Cos' I dont want to misuse it.
    ----------------------------------------------

    ----cheers
    ----http://mallier.blogspot.com

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    this is even simpler:
    Code:
    select count(*) from registered_users 
    where useridentifier < -120
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Jul 2002
    Posts
    229
    Thanks.
    I actually copied my first, invalid variant from a MySQL tutorial, I had never seen this kind of subselect before so I wanted to try it in SQL Server.

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    mysql does not require derived tables (what subqueries in the FROM clause are called) to have aliases, but sql server does

    that's the nice thing about sql standards, there are so many to choose from
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    Nov 2003
    Posts
    167
    And all this time I've been calling them Inline Views. I guess Derived Table makes more sense...

    mysql does not require derived tables (what subqueries in the FROM clause are called)
    Kit Lemmonds

Posting Permissions

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