I have a table with multiple reponses for an id and want to extract only the latest response. This is done using the following query : SELECT id, MAX(DateTime) as maxDateTime FROM contacts GROUP BY id.

I want to also relate this back to the same table to extract further information (Outcome and group on each Outcome) which I would usually do by using : SELECT Outcome, count(id) FROM contacts GROUP BY Outcome
however I'm having a bit of trouble putting the two queries together.

My question is, if I am using PHP how do I combine the two queries? I've read something about temporary tables - is this the way to go for the first part of the query then use it to match on the second query or is a sub-query the way to go? Could I also get some coding examples?
NOTE: I don't want to do a count on the whole table as there are multiple responses for each id and I only want to know what the count for most current response is.