sql join syntax
group by syntax, not 100% SQL but close enough