Re: messy SELECT & GROUPing
Posted in 1998
Ramiro,
Since you just want to count the number of areas, don't select any zone info
because, as you've alreday noted, the count is ambiguous. Try this:
select a1, a2, a3, a4, a5, count(*)
from <your_table>
group by 1,2,3,4,5
If you need specific zone information, a separate query will need to be
written to extract that information. Sufice it to say, that a single query
will not be able to provide you area counts plus detailed zone information.
Also, if you're not too far along in the process, you may want to revisit
and revise the schema to adhere to certain 'normal forms'. They should be
adhered to whenever possible and it will make your life and the lives of
others easier in the long run. I'll stop now. Thanks!
-Jonas