Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Quarterly Comparison Results
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00586640
Message ID:
00586653
Vues:
18
This message has been marked as a message which has helped to the initial question of the thread.
The empty date in the table will cause an error in the QUARTER() function.
SELECT year(date), quarter(date), count(person_id), 
  FROM service ;
  WHERE NOT EMPTY(date) ;
  GROUP BY 1, 2 
>Another day, another SQL question:
>
>I need to get quarterly student counts, where a student could appear in multiple quarters, they need to be counted for each quarter.
>
>My first question is simply why does this work...
>
>
>SELECT MONTH(date) FROM service
>
>
>but this doesn't...
>
>
>SELECT QUARTER(date) FROM service
>
>
>The latter returns an error: Function argument, date, type, or count is invalid
>
>Other than the above, I'm wondering generally how best to tackle this problem. I'm want something like:
>
>
>SELECT count(person_id), quarter(date);
>  FROM service;
>  GROUP BY quarter(date)
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform