Hello Dobromir,

Friday, October 8, 2004, 3:47:06 PM, you wrote:

DV> Hi,
DV> Using sub-selects (MySQL 4.1 and higher) you can use something like

DV> select count(*)/(select count(*) from table where field1='myvalue') as
DV> percentage from table where category='myvalue' group by category;

DV> but I don't think you will gain much in performance this way. I'd rather use
DV> two queries - one for the total and one for the percentages. If field1 is
DV> indexed 

DV> select count(*) from table where field1='myvalue' 

DV> should be quite fast, so I don't think you should worry about having an
DV> additional query.
You may be right.
I was just wondering, thanks for the input. I will go for two queries.
thanks


Best regards,
Jacques Jocelyn


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to