Subject | Re: [firebird-support] How do I limit an SQL search list to 10 records? |
---|---|
Author | Clyde Eisenbeis |
Post date | 2019-12-12T21:36:51Z |
Marcin, Minor tweak => works! I also added DESC to retrieve the newest records using the field key name (number is an auto increment).
`````````````````
"SELECT FIRST " + stNumOfRecordsToRetrieve + " * FROM " + stTableName + " ORDER BY " + fstKeyID + " DESC";
`````````````````
It's interesting that the newest records are found first (DESC), then the number of records retrieved are from those DESC record results.
`````````````````````````
On Thu, Dec 12, 2019 at 1:29 PM 'Marcin Bury' marcin.bury@... [firebird-support] <firebird-support@yahoogroups.com> wrote:
HiSELECT FIRST 10 * FROM A_TABLEShould workCheersMarcin------ Wiadomość oryginalna ------Od: "Clyde Eisenbeis cte677@... [firebird-support]" <firebird-support@yahoogroups.com>Data: 12.12.2019 19:59:44Temat: [firebird-support] How do I limit an SQL search list to 10 records?This finds all records:``````````````````````````````````"SELECT * FROM " + stTableName``````````````````````````````````This does not work:``````````````````````````````````"SELECT * FROM " + stTableName + " FETCH 10 ROWS"``````````````````````````````````