Skip to content
Advertisement

How can I count the amount of items per user?

What I need to do is to Count the Times a User has received the treatment ‘Oxygen’. I’m trying to do like below but I’m getting all of the entries from Treatment_Victim per user. Any help is well appreciated. Should I be using something else?

ID_Victim Name
1 John
2 Alex
ID_Treatment Name
1 Oxygen
2 Transfussion
ID_Treatment_Victim ID_Victim ID_Treatment
1 1 1
2 1 1
3 1 2
4 2 1

Advertisement

Answer

Never use commas in the FROM clause. Always use proper, explicit, standard, readable JOIN syntax:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement