I need help with writing some SQL code. I have a table organized like the following.
| name | code |
|---|---|
| Jill | drug |
| Jill | alc |
| Matt | drug |
| Sally | drug |
| Max | alc |
| Millie | other |
| Rob | drug |
I need to count how many people (name) are designated to drug only, how many are designated to alc only, and how many are drug and alc. Output should look like:
| code | Count |
|---|---|
| drug | 3 |
| alc | 1 |
| drug & alc | 1 |
So Millie wouldn't be included in these counts bc I just want to look at drug and alc for the code.
Please help I can't figure it out!!