Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Group by
Message
From
23/09/2009 19:58:59
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01425843
Message ID:
01425848
Views:
46
And I kept trying to use COUNT!

Thanks Sergey and Naomi!

>
>select int_id, street1, street2, count(int_id) as crashes ;
>  , SUM( IIF(INJURY_SEV=1, 1, 0) ) AS sev1  ;
>  ...
>  , SUM( IIF(INJURY_SEV=6, 1, 0) ) AS sev6  ;
>
>
>>I am still trying to get the SQL group by clause down. Can someone help me with this?
>>The table contains a record for each accident at intersections in the city. Fields are an intersection identifier INT_ID, the 2 cross streets STREET1 and STREET2, injury severity INJURY_SEV coded 1 through 6. I want to obtain 1 record per intersection containing the total number of crashes at the intersection plus the total number for each of the 6 severity codes. This works for the total but I can't figure out how to add the six severity codes.
>>
>>
>>select int_id, street1, street2, count(int_id) as crashes;
>>	from crash1 ;
>>	group by int_id, street1, street2 ;
>>	order by crashes desc, int_id
>>
>>
>>Thanks
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform