Re: Totals Across Multiple Records

2005-07-23 Thread Albert Padley
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

Re: Totals Across Multiple Records

2005-07-22 Thread Peter Brawley
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

Totals Across Multiple Records

2005-07-22 Thread Albert Padley
I would be grateful if those of you around this weekend could help me figure out if what I'm after is possible. I've already spent hours with the manual, the archives and my books. I've looked at JOINS and TEMP TABLES but still can't come up with a solution. THE ENVIRONMENT: MySQL Version