Interesting Query | DBA THINGS

Interesting Query


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

neurontin side effects querysql

Then he asked me to get first 7th id row then 15th id row then 10th id row after this other rows-

fenofibrate (tricor) 145 mg tablet I tried few queries, Hope this will help you too-

Solution1 :

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)


how to buy isotretinoin in canada Solution2:

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


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: