Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with other Select-SQL
Message
De
05/04/2001 22:42:52
 
 
À
05/04/2001 21:46:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00492641
Message ID:
00492654
Vues:
17
>Hi guys!
>
>I have a table with the next rows:
>
>field1 field2
>Site A Cell 101
>Site A Cell 101
>Site A Cell 102
>Site A Cell 102
>Site A Cell 103
>Site A Cell 104
>Site B Cell 201
>Site B Cell 201
>Site B Cell 205
>
>
>well, I am locking for sql statment that produces the next dataset result:
>Site Cells_Working
>Site A 4
>Site B 2
>
>I'am trying with :
>Select field1 as site,count(field2) as Cells_working from mytable group by; field1
>but it doesn´t work
>Thanks in advance
>martin Alcaraz
>malcaraz@rtn.uson.mx

You can get there with 2 SQL statements.
Try this:
SELECT DISTINCT field1 AS site, field2 AS cell ;
       FROM mytable ;
       GROUP BY 1,2 ;
       INTO CURSOR pass1
SELECT site, COUNT(*) FROM pass1 GROUP BY 1
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform