[Zope] Probably Dumb Question re count(*)

Dan Shafer dan@gui.com
Sun, 30 Dec 2001 17:01:42 -0800


Matt Goodall suggested:

>Change the "countrecords" SQL method to
>
>     select count(*) as num_records from xyz
>
>so that you know the name (num_records) of the column. Then use the
>following to display that count:
>
>     <dtml-var "countrecords()[0]['num_records']">
>
>The DTML is simply getting the column named num_records from the 1st row
>of the result set.

Thanks, Matt. Worked like a charm. The MySQL book I have mentioned 
the AS option but didn't include it in the reference section I was 
looking in, so I didn't remember how to do this column aliasing thing!
-- 
Dan Shafer, Author-Consultant
http://www.danshafer.com
http://www.shafermedia.com