[Zope-DB] Z SQL equivelant of MySQL's SQL_CALC_FOUND_ROWS?
Charlie Clark
charlie at egenix.com
Tue Nov 29 16:32:03 EST 2005
On 2005-11-29 at 20:20:10 [+0100], Kevin Monceaux <Kevin at RawFedDogs.net>
wrote:
> 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.
You can use <dtml-var sqldelimiter> - search the archives for that.
But that is wrong. If you want to count the number of records, use count()
Charlie
--
Charlie Clark
eGenix.com
Professional Python Services directly from the Source
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
2005-10-17: Released mxODBC.Zope.DA 1.0.9 http://zope.egenix.com/
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the Zope-DB
mailing list