Re: Sort array from a Query
- From: "Sean" <oreilly.sean@xxxxxxxxx>
- Date: 29 Nov 2005 10:09:05 -0800
Follow this up in the sql forums, but you want something like this:
SELECT b.BREWERY_CODE, b.BREWERY, COUNT(c.id) as num_coaster
FROM breweries b LEFT JOIN coasters c ON b.BREWERY_CODE =
c.BREWERY_CODE
Group by b.BREWERY_CODE
order by COUNT(c.id) DESC
UNTESTED!
This will get you what you want in one pass. (i think)
.
- Follow-Ups:
- Re: Sort array from a Query
- From: bettina
- Re: Sort array from a Query
- From: bettina
- Re: Sort array from a Query
- References:
- Sort array from a Query
- From: bettina
- Sort array from a Query
- Prev by Date: Re: confused: casting a variable to integer
- Next by Date: Re: setting up a A/B split test with PHP
- Previous by thread: Re: Sort array from a Query
- Next by thread: Re: Sort array from a Query
- Index(es):
Relevant Pages
|