I have been trying to get bureau name and count.
show_graph_controller.rb
def index8
@bureau=Incident.find(:all,:conditions=>“receipt_date LIKE
‘2009-05%’”,:select=>“distinct bureau_id,count
(*)”,:group=>“bureau_id”,:having=>“office_id=17”)
end
index8.html.erb
Bureau name | Count | C | D |
---|---|---|---|
<%=h(Bureau.find(incident.bureau_id).name) %>e$BBfe(B |
How I can get count(*)?
I can get count(*) in SQL.
SELECT bureau_id,count(*) FROM incidents group by bureau_id having
office_id=17
Best regards,
Yoshida