I have this table view
UserName Product NumberPurchaces
-------- ------- ---------------
\'John Doe\' \'Chair\' 4
\'John Doe\' \'
I guess one would have to write some code to dynamically create the query. Each MAX() line is identical except for the 'CHAIR', 'TABLE', etc, strings.
So, one would have to itterate through the data to find all the products and build up a second query as one goes. Then execute that dynamically built query.