Connecting Tech Pros Worldwide Forums | Help | Site Map

Select Top Alters Order

jw56578@gmail.com
Guest
 
Posts: n/a
#1: Jul 23 '05
If i have two identical queries, with exception of top criteria

Select top 1 * from photos

Select top 8 * from photos

why does altering the top critieria alter the order of the returned
results?


Simon Hayes
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Select Top Alters Order



<jw56578@gmail.com> wrote in message
news:1120758806.014642.142300@z14g2000cwz.googlegr oups.com...[color=blue]
> If i have two identical queries, with exception of top criteria
>
> Select top 1 * from photos
>
> Select top 8 * from photos
>
> why does altering the top critieria alter the order of the returned
> results?
>[/color]

The only way to get data in a certain order is to use ORDER BY - rows in
tables have no order, so you need to tell MSSQL what order you want. See
SELECT in Books Online, which notes that TOP without ORDER BY returns
"arbitrary" rows.

Simon


Closed Thread