Retirn only a limited number of results.

  • Thread starter Thread starter Kenneth Keeley
  • Start date Start date
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
 
Hi,
You can do it this way
select top 10 newsitems from newsTable order by date_time

HTH
srini
 
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
 
Back
Top