Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Syntax between two tables
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00212848
Message ID:
00213048
Vues:
32
>>I want to make a small temporary table with two columns, one to show unique names that appear in a larger table, and the other for how many times each name occurs.
>>
>>USE majors
>>DIMENSION listt(20)
>>SELECT DISTINCT advisor FROM majors WHERE !EMPTY(advisor) INTO ARRAY listt
>>CREATE TABLE tempadv FREE (name C(20), number N(2))
>>APPEND FORM listt FIELDS name
>>
>>Up to this point it works. The first column has one of each name from the larger table.But how exactly do I use COUNT to get the number of times each name occurs in the larger table? I have trouble with the FOR clause. I've even tried macro substitution (which I know is a bad idea) but I can't get the statement to pass the name from the table and use it to filter records in the other.
>
>Peter,
>
>Try this:
>select count(*),advisor from majors group by advisor into cursor mycursor

Just small changes:
select advisor,count(*) from majors where !empty(advisor) group by 1 into array listt
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform