12,951,619 members (59,663 online)
Rate this:
See more: , +
hi
a have this table
My table name is NEWS
and this fields: NewsId ,NewsTitle,NewsDate
a want get a query
by select
a want select 3 record of this table
this 3 record is 3 last news by date
i want get 3 record of end of table (3 record of end time,not of end table)
Posted 6-Jun-12 10:09am

Rate this:

## Solution 1

Here you go:

`SELECT TOP 3 NewsId, NewsTitle, NewsDate FROM NEWS ORDER BY NewsDate DESC`

The following orders the results so the newest are at the top:

`ORDER BY NewsDate DESC`

The following instructs the SELECT to get just the first 3 rows:

`SELECT TOP 3`
v2

ok,
thx
if i want get 3 record of end of table !!!!!
thatraja 6-Jun-12 16:22pm

Try `ORDER BY NewsDate ASC`

ok
losmac 6-Jun-12 18:31pm

Good work, my 5!
VJ Reddy 10-Jun-12 5:04am

Rate this:

## Solution 2

You can use a simple trick to get last 3 records in ascending order.

```SELECT *
FROM (SELECT TOP 3 NewsId, NewsTitle, NewsDate FROM NEWS ORDER BY NewsDate DESC) AS DT
ORDER BY DT.NewsDate```
VJ Reddy 6-Jun-12 19:52pm

losmac 7-Jun-12 3:11am

Thank you, VJ ;)

Top Experts
Last 24hrsThis month
 OriginalGriff 740 CPallini 240 F-ES Sitecore 225 Maciej Los 170 RyanDev 155
 OriginalGriff 6,229 CHill60 3,490 Maciej Los 3,083 Jochen Arndt 1,975 ppolymorphe 1,880