nick
1
Dear all,
I’m trying to figure out how many rows I have for each group in the
following query:
@trails = Trail.find(:all,
:select => "country",
:group => "country")
How can I change this query to retrieve one column with the “country”
list and one with a “count” column ?
Thank you,
Nick,
nick
2
It is illegal in SQL to have count star and another col. So I tkink u
can’t do it
Sent from my iPhone
nick
3
The SQL line itself would be:
SELECT count(*), country FROM trails GROUP BY country;
So, it is perfectly legal.
I don’t know how to do this in Rails though, but I can’t imagine there
not being a way…
–Michael
nick
4
That’s it! Thanks!
On Oct 18, 3:53 am, Frederick C. [email protected]
nick
5
Is Trail.count :all, :group => ‘country’ what you want?
Fred