Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Group by
Message
 
 
À
23/09/2009 19:08:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01425843
Message ID:
01425845
Vues:
105
This message has been marked as the solution to the initial question of the thread.
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
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform