Sol and Peter,
Thanks for your feedback. Both of your suggestions got me going in
the right direction and I was able to solve the problem using
temporary tables and left joins.
Thanks again.
Albert Padley
On Jul 23, 2005, at 11:00 AM, sol beach wrote:
create table count_temp1 select i
Albert,
Your spec isn't entirely clear to me (eg if sd1 & sd2 were 'unique
within each record', wouldn't there be zero rows where sd1=sd2?), but is
this what you're looking for ...
SELECT
zz,
COUNT(zz) as zzCount,
SUM(IF(zz=sd1 AND sd1=sd2, 1, 0)) AS sd1sd2Count
FROM ss
GROUP BY zz;
Peter
At 10:19 -0800 3/24/04, Craig Gardner wrote:
I need to get totals for the data in my database. I stumbled upon
the "WITH ROLLUP" modifier
(http://www.mysql.com/doc/en/GROUP-BY-Modifiers.html) and it appears
to be exactly what I'm looking for, except for the fact that when I
try to use it I get