# Database Discussions > Microsoft SQL Server 2005 >  Plz help me with select statment

## mirza21

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

----------


## rmiao

Sql sorts table first then pick up top 3.

----------


## mirza21

thanks friends

----------

