Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 3rd, 2007, 02:58 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default simple but knowledgeable pls help

Hi

After checking the query to find nth row in a table on this forum. I tried ( JUST TO LEARN) with rownum, what I have done is
1. select sal from emp where rownum=1 order by sal;
it gives me the 1st row. Then

IN ORDER TO GET 5TH ROW
2. select sal from emp where rownum=5 order by sal;
but it gives me no rows selected.
why this strange behavior.???

Please help me.


 
Old March 9th, 2007, 09:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Is RowNum a column in your emp table?

_________________________
- Vijay G
Strive for Perfection
 
Old March 11th, 2007, 11:21 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No vijay....

 
Old March 12th, 2007, 12:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

1. select sal from emp where rownum=1 order by sal;
it gives me the 1st row.... Then how do you say this works?

_________________________
- Vijay G
Strive for Perfection
 
Old March 12th, 2007, 02:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Dont be insulted, but are there 5 rows in the table?

======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================





Similar Threads
Thread Thread Starter Forum Replies Last Post
help me pls.. heera Apache Tomcat 2 August 29th, 2007 06:48 AM
Help, pls! jjyang Visual Basic 2005 Basics 2 May 25th, 2007 12:06 PM
pls auwalsaleh Crystal Reports 0 February 20th, 2006 10:18 AM
Simple Query help pls? Mitch_A SQL Language 5 February 3rd, 2006 05:13 PM
Pls help me! hoailing22 ASP.NET 1.0 and 1.1 Basics 5 June 9th, 2005 09:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.