[Zope-DB] Z SQL equivelant of MySQL's SQL_CALC_FOUND_ROWS?
Kevin Monceaux
Kevin at RawFedDogs.net
Tue Nov 29 14:20:10 EST 2005
Zope Enthusiasts,
I'm new to Zope so forgive me if the answer to this question is obvious. If
one performs a select with a limit clause is it possible to determine how
many results would have been returned if there was no limit? For example,
if I wanted to select the first picture in a photo album but wanted to know
the total number of pictures in the album, how would I do that via Z SQL?
With MySQL it can be done this way:
SELECT SQL_CALC_FOUND_ROWS, * from Pictures where AlbumID = 25 LIMIT 1;
SELECT FOUND_ROWS() as Count;
According to the "Z SQL Methods User's Manual" multiple SQL statements can
be included in a Z SQL method but that no more than one select statement can
be included. The above MySQL technique requires two select statements.
Kevin
http://www.RawFedDogs.net
Bruceville, TX
More information about the Zope-DB
mailing list