sql search

Ivan Smahin ivan_smahin at valentina-db.com
Wed Apr 19 22:34:59 CDT 2006


Hello jda,

Wednesday, April 19, 2006, 10:10:02 PM, you wrote:

> Hi Ruslan,

> I'd like to have a search that always returns the last 15 records in 
> a db. I have an integer field, id, that keeps track of all entries in 
> sequential numbers. Here's the kind of thing I'd like:

>      select * from tableA where id > (totalrecords- 15)

> What would the proper Valentina SQL be for "totalrecords"? (assuming 
> this can be done at all).

The first thing comes to my mind is something like this:

select * from tableA where id > (select count(*) - 15 from tableA )

But it could be expensive query.

Probably this task can be redesigned in someway?
If no - put the feature request to the mantis please.


-- 
Best regards,
 Ivan                            mailto:ivan_smahin ÎÁ valentina-db.com



More information about the Valentina-beta mailing list