[thelist] SQl: Top xx
Philippe Jadin
philippe.jadin at 123piano.com
Thu Apr 12 03:49:21 CDT 2001
> I'm looking for a generic SQL way to get the latest x number of records
> based on date. I know on MS SQL Server I can use TOP, but I don't think
> that is "cross-database" compatible. Right now, I am using the MaxRows
> attribute of CFQUERY to limit the number, but I'd rather do it in the
query.
> This is for an application that could be run on most popular databases, so
I
> would llike to make it as DB agnostic as possible.
If I understand well :
select * from mytable order by date desc limit 30
Or did I miss something? I'm in no way an sql guru. (Though I may be
agnostic)
Philippe
More information about the thelist
mailing list