Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
SQL SELECT and COUNT - how?
I have a table with 4 fields of interest: user_id, user_source, task_id, subTask_id. I would like to know things like how many users (user_id) from each source (user_source) used each task (task_id), and how many users (all sources) used each sub task (subTask_id). I do not want to count duplicates (the same user_id using the same subTask_id for example). The output should be a cursor showing each user_source, the subTask_id, and the number of users from that source who used this subTask_id. For example:
Source_ID sub_ID num_Users
1 2 15
1 3 25
2 2 19
and so on ...
I know I can do this the hard way by using variables and incrementing counters, but how can I do this using SQL SELECT and COUNT?
Mon
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement