Re: Sum of counts

2006-05-11 Thread Joerg Bruehe
Hi Adam, all, Adam Wolff wrote: You could you use UNION to make this all execute in a single query. Sure you can use UNION to get the data or the (separate) counts from the four tables, but a plain UNION can not sum over these individual parts. I have not checked whether you can have a UNI

Re: Sum of counts

2006-05-11 Thread Joerg Bruehe
Hi Rhino, all, Rhino wrote: Hi Chris, Joerg, and everyone else following this discussion, Joerg, you are correct; the best way to sum the tables is individually and then add the sums together with program logic of some kind, [[...]] I'm afraid I jumped in and gave correct but irrelevant inf

Re: Sum of counts

2006-05-10 Thread Adam Wolff
e - From: "Joerg Bruehe" <[EMAIL PROTECTED]> To: "Chris Sansom" <[EMAIL PROTECTED]> Cc: "Rhino" <[EMAIL PROTECTED]>; "MySQL List" Sent: Wednesday, May 10, 2006 12:04 PM Subject: Re: Sum of counts > Hi Chris, all, > >

Re: Sum of counts

2006-05-10 Thread Rhino
EMAIL PROTECTED]> Cc: "Rhino" <[EMAIL PROTECTED]>; "MySQL List" Sent: Wednesday, May 10, 2006 12:04 PM Subject: Re: Sum of counts Hi Chris, all, Re-inserting Chris' original question: | I want to get a total of entries from four tables which all match a | particu

Re: Sum of counts

2006-05-10 Thread Joerg Bruehe
Hi Chris, all, Re-inserting Chris' original question: | I want to get a total of entries from four tables which all match a | particular id. The result for the id I'm testing (21) should be 233. | In my naivety, I thought something like this would work: | | select count(a.id) + count(b.id) + cou

Re: Sum of counts

2006-05-09 Thread Chris Sansom
At 13:28 -0400 9/5/06, Rhino wrote: The reason you are getting so many rows has nothing to do with the way you are using the count(*) function and adding the different count() results together. The problem is that you are doing your joins incorrectly... In your case, I think you need to change

Re: Sum of counts

2006-05-09 Thread Rhino
- Original Message - From: "Chris Sansom" <[EMAIL PROTECTED]> To: "MySQL List" Sent: Tuesday, May 09, 2006 11:47 AM Subject: Sum of counts Here comes a newbie question... I want to get a total of entries from four tables which all match a particular id. The result for the id I'm t