sql server - In clauses problems -
i have been execute simple 3 sql query
select * table rowid in(1,2,3) select * table rowid in(2,1,3) select * table rowid in(3,2,1)
all query return same result. means execute query first in(1,2,3) result like
1) first record rowid 1
2) second record rowid 2
3) third record rowid 3
same other query.
if i'm calling second , third query result same first query want result rowid calling sequence.
you need order by
:
select * table rowid in(1,2,3) order rowid asc select * table rowid in(2,1,3) order ( case rowid when 2 1 when 1 2 when 3 3 end ) select * table rowid in(3,2,1) order rowid desc
Comments
Post a Comment