Retirn only a limited number of results.

K

Kenneth Keeley

Hi
How can I limit the number of results returned from and SQL database to a
datagrid. Ie I only want to return the latest ten news items for a news and
events page.

Thanks
Kenneth
 
G

Guest

Hi,
You can do it this way
select top 10 newsitems from newsTable order by date_time

HTH
srini
 
A

Anton Sokolovsky

Latest 10 should have DESC direction of ordering

select top 10 newsitems from newsTable order by date_time desc

assuming that "date_time" is of datetime type
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top