PDA

View Full Version : Sql select count(*)


RayYates
08-14-08, 06:33 PM
How would I structure an <MvOPENVIEW> QUERY expression to find out how many products were assigned to a category?

BillBuilt
08-14-08, 07:05 PM
Ray,
I dont know the specifics for Merchant, but it should be something like:

SELECT count(*) AS `tlRecs` FROM `[tablename]` WHERE `[catfield]` = '[catValue]';

then access the number via viewname.d.tlRecs

Of course this has to be looped through each different category. Check the MySQL manual, there's a GROUP BY... WITH ROLLUP feature that might work better if you want to use only 1 MvOPENVIEW.

Bill

RayYates
08-16-08, 08:52 AM
Thanks that got me going on the right path.