I'm having trouble doing multiple counts with groups, ordering, and
joins. Can someone help me out? Below is two table samples and what
I'm trying to get my output to be:
TABLEA
ID CHIP
----------- ----------
1 Lays
1 Ruffles
1 Ruffles
1 Ruffles
1 Doritos
1 Doritos
2 Lays
2 Lays
2 Doritos
3 Ruffles
TABLEB
ID NAME
----------- ----------
1 Jim
2 Bob
3 MISSY
What I'm hoping to get is the following rows:
Bob 2 0 1
Jim 1 3 2
MISSY 0 0 1
This is the name, count(lays), count(ruffles), count(doritos) ordered
by name. I thought it would be rather easy but can't seem to get it
for some reason. Any help would be greatly appreciated!