Results 1 to 8 of 8

Thread: Order By Clause

  1. #1
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270

    Unanswered: Order By Clause

    Hello,
    can any one tell me about the difference between the following queries.



    1. SELECT * FROM Symp_User ORDER BY
    2. SELECT * FROM Symp_User ORDER BY ASC


    I don't think there is any difference in the above queries. kinldy make me clear on this.


    thnkx,
    rahul jha

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    Server: Msg 170, Level 15, State 1, Line 1
    Line 1: Incorrect syntax near 'BY'.
    I think you forgot to mention which field you want to order the result set by

    ASC/DESC are optional operators used in conjunction with the ORDER BY clause. If omitted ASC is assumed.
    Last edited by gvee; 09-05-07 at 07:45. Reason: change highlighted
    George
    Home | Blog

  3. #3
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270
    sorry for the miss out. here is the actual query........



    1. SELECT * FROM Symp_User ORDER BY LoginName
    2. SELECT * FROM Symp_User ORDER BY LoginName ASC


    My question is, whether will there be any Execution Plan difference for the above queries?


    thnkx
    rahul jha

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by georgev
    If omitted ASC is assumed.
    See above
    Last edited by gvee; 09-05-07 at 07:46.
    George
    Home | Blog

  5. #5
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270
    thnkx george

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    negated??? don't you mean omitted?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Yes, yes I do...
    Posts edited
    George
    Home | Blog

  8. #8
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    My question is, don't you acces to SQL Server?

    I mean it would be very easy to find out if you do, and if you don't, then download the dev version for free
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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