Using MySQL, I have an athlete table, with ath_no and team_no

A team table that has the key team_no

And a table call extras, that has the ath_no, a column call tshirt_size, the tshirt column can either be NULL, S, M, or L. There's another column call ticket (to see if the athlete has a ticket or not), and it can be either 0 or 1.

A team has many athletes, and each athlete belongs to one team, each athlete has a tshirt_size and a 0 or 1 in the ticket column in the extras table.

Is it possible that for each team, to count the number of shirts for each size and the number of tickets?

eg. a query that will generate something like:

TeamName    S    M    L    Tickets
Team 1      5    0    2         17
Team 2      4    5    0          8
It won't be hard to use multiple queries with a bit of help from PHP, just wondering if there's a pure SQL way to do this