Re: urgent: Trying to get COUNT for fairly elaborate query

From: Date: Mon, 16 Oct 2006 01:51:41 +0000
Subject: Re: urgent: Trying to get COUNT for fairly elaborate query
References: 1 2 3 4 5  Groups: php.db 
Request: Send a blank email to php-db+get-42559@lists.php.net to get a copy of this message
sneakyimp wrote:
chris smith-9 wrote:
Ah - that would be the group by doing that. Removing those: GROUP BY eta.id ORDER BY subcat_count DESC, eta.id Does that get you what you want? If it gives you one result - make sure it's right. Change a few id's, make sure they match up to what your other query returns.
I really appreciate your help by the way. I've also tried that. I do get a single value when I do that but the count is too high! Each of the esa associations gets counted separately rather than just once. The original COUNT and GROUP BY parts limit the number of records by aggregating all the esa records per event into a single count - which is what i want.
I don't understand. What results do you get from the original query (just the 2-3 columns we need please) ? What does the "new" query (that doesn't work) give you? What do you want to get from the count query? -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.db (#42559) next »