PDA

View Full Version : selecting last rows in database


Phip
10-22-2002, 08:26 AM
i know you can use:

"select top 7 from table"

but how can i select the last rows?

or is there something like

"select * from table limit 7"?:confused:

Phip
10-22-2002, 08:29 AM
i need it to ascend not descend

Roy Sinclair
10-22-2002, 03:16 PM
Use the select with sorted descending to get the records you want then use the recordset.sort property to change the sort order within the recordset to be ascending.

Phip
10-22-2002, 05:28 PM
it is possible to do it any other way? I get the error:

ADODB.Recordset error '800a0cb3'

Current provider does not support the necessary interfaces for sorting or filtering.

/default.asp, line 173

Roy Sinclair
10-22-2002, 06:18 PM
Do it this way then:

select * from (select top 7 * from table order by field desc) order by field

Phip
10-22-2002, 08:16 PM
thank you very much! you made my day. :D :thumbsup: