Results 1 to 3 of 3

Thread: Plz help me with select statment

  1. #1
    Join Date
    Oct 2008
    Posts
    2

    Plz help me with select statment

    Hi friend i am new to sql and facing problem in writing select queries

    Plz help me know how sql query gets data from server , i am unable to understand the flow of query , i could not make out which part of query is executed first.

    chk this case:-

    select top 3 with ties ProductName,UnitsOnOrder from Products order by UnitsOnOrder desc


    1) As per me it executes left to right .First it select top 3 records from products table then order them and then arrange then in descending order

    but results i am getting are different


    so please help me logically understand how above select statement works

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Sql sorts table first then pick up top 3.

  3. #3
    Join Date
    Oct 2008
    Posts
    2
    thanks friends

Posting Permissions

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