Re: Two "COUNT"s in one query

2009-04-23 Thread Nigel Peck
Thanks to everyone who helped me out with this, just what I needed and this is now working for me. One further question... I'm using a subquery as suggested: SELECT `Organisations`.`organisation_id`, `Organisations`.`name`, (SELECT COUNT(*) FROM `Notes__Organisations` WHERE `Notes__Organ

Re: Two "COUNT"s in one query

2009-04-21 Thread Peter Brawley
Nigel, >I want to select the name and id from "Organisations" >along with a count of the number of one-to-many >relationships it has in each of the two tables. Aggregation multiplies across multiple joins. For suggested solutions see "Aggregates across multiple joins" at http://www.artfulsoftw

Two "COUNT"s in one query

2009-04-21 Thread Nigel Peck
I think I probably can't do what I want, but am hoping I'm wrong. Please help :) I have three tables: Organisations - organisation_id - name - - 1 - Org A - - 2 - Org B - No