Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to limit the number of returning data?

Author  Topic 

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2010-11-09 : 04:22:09
Hi,

I have a sql statement lets say;

Select field1,field2,field3 from table1 where field4 > '1000'

and the above statement returns 200 numbers of data. But i would like to get first 30 of them.

Any help please?

thanks in advance.

Best Regards

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-09 : 04:24:45
Select TOP (30) field1,field2,field3 from table1 where field4 > '1000'
ORDER BY ...




No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-11-09 : 04:25:24
Select Top 30 field1,field2,field3 from table1 where field4 > '1000'
Order by 'It depends on the columns on which you define your first 30'


PBUH

Go to Top of Page

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2010-11-09 : 04:28:51
thanks both of you
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-09 : 04:31:57
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -