Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Amjath
Yak Posting Veteran
66 Posts |
Posted - 2010-07-23 : 00:24:45
|
I have a problem, depends on the selecting items, my display order got changed. the case where im facing problemSELECT a1,b1 FROM Table1 WHEREb1 IN (86429, 134486, 49816) SELECT a1,b1,c1,d1 FROM Table1WHERE b1 IN (86429, 134486, 49816) SELECT b1,a1,c1 FROM Table1WHERE b1 IN (86429, 134486, 49816) All these above mention query give same output, but the order is different.I have following Index on my table1)d1, c12)c1, b13)b1Moreover a1 is a primary key.moreover, plz let me know how data will be displayed if i didnt specify any order by field.with thanks & regardsAmjath |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-07-23 : 00:33:21
|
without specifying the ORDER BY clause, the sequence of the records return is random / non-deterministic. There is no guarantee it will return in the same sequence every time you execute the query KH[spoiler]Time is always against us[/spoiler] |
|
|
Amjath
Yak Posting Veteran
66 Posts |
Posted - 2010-07-23 : 00:37:39
|
So it means, chances of getting different sequence of record for the same query.Thanks a lot |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2010-07-23 : 04:40:19
|
Yup. If you need a specific order, specify the appropriate ORDER BY--Gail ShawSQL Server MVP |
|
|
|
|
|
|
|