I´m using Sqlite3 on a grid application pretty much like that post here..
The grid needs the rows that is being show and the total number of rows found, used for paging.
On Oracle I use the following statement to get rows from 100 to 500 - fields Id, Name, Phone where Deleted=false:
SELECT * FROM (SELECT ROW_NUMBER()
OVER (ORDER BY ID) AS RN,
COUNT(*) OVER (ORDER BY (SELECT NULL) AS CNT)
Id, Name, Phone FROM MyTable WHERE Deleted='F')
T WHERE RN > 100 AND RN < 500;
On MySQl, I normally use the excellet SELECT SQL_CALC_FOUND_ROWS
followed by a SELECT FOUND_ROWS()
call.
So my questions are:
a) Is there any equivalent of this Sqlite3 for either Oracle or MySQL option above ? b) How can I accomplish that on Sqlite3 without issuing 2 selects (one for querying and another one for counting) ?
Thanks a lot for helping...
Aucun commentaire:
Enregistrer un commentaire