Interesting Query


see Hi Guys! Today one of trainee in my team asked me one strange question, he shows a table and data –

valutahandel synonym querysql

click here Then he asked me to get first 7th id row then 15th id row then 10th id row after this other rows- I tried few queries, Hope this will help you too-

cosa e un opzione binaria Solution1 :

see url select * from sales where id=7
union all
select * from sales where id=15 –and id not in (7)
union all
select * from sales where id=10 –and id not in (7,15)
union all
select * from sales where id not in (7,10,15)

opcje binarne z najmniejszym depozytem querysql1

source url Solution2:

enter Select * from sales
Order by Case when id=7 then 1 when id=15 then 2 when id=10 then 3 else 4 End

follow querysql2

I am Microsoft Certified Professional for querying & Administering Sql Server. I believe “The greatest barrier to success is the fear of failure.”
I am also available at

%d bloggers like this: