Click here to Skip to main content
14,668,490 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 2

Try putting the order by with in the subquery as well. hope it resolves your issue.
   
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. :)
Rate this:
Please Sign up or sign in to vote.

Solution 1

Hi,

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

Regards,
RK
   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100