SEO Forum
 
SEO Problems SEO Knowledge Database Seo Forum Search engine optimization
  FAQ   Search   Memberlist   Usergroups   Register   Profile   Log in to check your private messages   Log in 
LIMIT Statement

 
Post new topic   Reply to topic    Seo FORUM » Database Related Techniques View previous topic :: View next topic  
LIMIT Statement
 PostPosted: Sat Mar 22, 2008 6:29 am Reply with quote  
Message
  Elizabeth Enright

Joined: 20 Feb 2008
Posts: 6

Hi Friends,

I have worked in PHP and MySQL for the past few months. In that i have used the LIMIT statement to retrive certain number of records
(eg: select * from table_name limit 5,20
means selecting [20] records of all information from the selected table starting from the [5]th record.

Right now, I hav been involved in ASP and MSSQL project, in which i cant use the LIMIT statement to do the similar operation in MS SQL.....

Please help me....
hai
 PostPosted: Sat Mar 22, 2008 7:26 am Reply with quote  
Message
  Greenrose

Joined: 17 Mar 2008
Posts: 17

hai

The MS SQL eqivalent of MySQL's LIMIT clause is TOP. Example:

SELECT TOP 10 * FROM stuff;

Will return the top ten rows, effectively doing the same thing as

SELET * FROM stuff LIMIT 10;

would do.

regards

Laughing
 PostPosted: Sat Mar 22, 2008 7:45 am Reply with quote  
Message
  nancy

Joined: 14 Mar 2008
Posts: 15

hi all,

In MSSQL we can use top keyword , but it will fetch the row from starting. so for your application it is not applicable.

I am not aware of limit keyword in MSsql , but we can use BETWEEN keyword. I think it will work for your condition.

SELECT *
FROM "table_name"
WHERE "column_name" BETWEEN 'value1' AND 'value2'

check this whether it is working or not??


Thanks,
Nancy


Confused
 PostPosted: Wed Mar 26, 2008 12:26 pm Reply with quote  
Message
  Martin Nordenso

Joined: 20 Feb 2008
Posts: 10

Hi Nance & G Rose,

Both of ur statements are incorrect… As Nance said “Top” is used to retrieve the selected row values from the top… Where as the BETWEEN…AND… operator used to select a range of column data’s between two values.
For example, select * from emp where Emp id between 2 and 5; displays
Emp id:
2
3
6
10
Where as limit function is used as
Select * from emp limit 1,3; will display
3
6
10
Please let me know if I had made any mistakes in this….
 PostPosted: Wed Apr 02, 2008 3:26 am Reply with quote  
Message
  nancy

Joined: 14 Mar 2008
Posts: 15

hi Martin,


cool....... Laughing I agree that the code i ve posted will be used to select a range of column data’s between two values.


so if you know the correct code for this reply me.....




Thanks,
nancy
Post new topic   Reply to topic    Searchenginegenie.com Forum Index » Database Related Techniques

Page 1 of 1
All times are GMT

Display posts from previous:

  

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Search Engine Optimization SEO Company