Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two tables and i want to select 1-50 records and i get what i want,
and im using this query..

SELECT TOP 50 tbl_Standard.*
FROM tbl_Standard INNER JOIN
tbl_Mom_Type ON
tbl_Standard.Standard_No = tbl_Mom_Type.Standard_No
ORDER BY tbl_Mom_Type.Date_of_Meeting DESC


in next i want to select 50-100 records.
and i use this query.

SELECT TOP 50 tbl_Standard.*
FROM (SELECT TOP 100 tbl_Standard.*
FROM tbl_Standard INNER JOIN
tbl_Mom_Type ON
tbl_Standard.Standard_No = tbl_Mom_Type.Standard_No)
tbl_Standard INNER JOIN
tbl_Mom_Type ON
tbl_Standard.Standard_No = tbl_Mom_Type.Standard_No
ORDER BY tbl_Mom_Type.Date_of_Meeting DESC

But it did not display the records i want.
Thanks in advance..
Posted

Try putting the order by with in the subquery as well. hope it resolves your issue.
 
Share this answer
 
Comments
melvinn 15-Nov-13 3:29am    
Thak you for the suggestion. it works fine, but it gives me the same output.. :|
ArunRajendra 15-Nov-13 3:39am    
Just a guess try making outer order by to asc.
melvinn 15-Nov-13 3:57am    
Thank you! I finally got it now, but the output is asc. because if I change it to DESC it get back to same output.. Thank you very much for the help. It helps me a lot.. =)
ArunRajendra 15-Nov-13 4:22am    
My pleasure. Can you mark it as answered so that other know this issue resolved thorugh this solution?
melvinn 15-Nov-13 21:04pm    
No problem. Thank you. :)
Hi,

See this link [^]for your reference.
Hope this helps you a bit.

Regards,
RK
 
Share this answer
 
Comments
melvinn 15-Nov-13 3:27am    
Thank you for the reply sir. but Im using SQL Server 2000
the ROW_Number() is not recognize in SQL 2k.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900