Recent friend activity fixed!

Here is the query to get the recent activity of userid=4's friends (yes,
this is all one query):

SELECT userid, username, date, achType, achName, achIcon,
quizid,quizname, quizscore FROM (select friend2 from friends where
friend1=4) foo JOIN (select achievements.userid, users.username,
achievements.dateachieved as date, achievements.type as achType,
achievementTypes.name as achName, achievementTypes.icon as achIcon, null
as quizid, null as quizname, null as quizscore from achievements JOIN
achievementTypes ON (achievements.type = achievementTypes.id) JOIN users
ON (users.id = achievements.userid) UNION ALL select quizzes.authorid as
userid, users.username, quizzes.datemade as date, null, null, null,
quizzes.id as quizid, quizzes.name as quizname, null from quizzes JOIN
users ON (quizzes.authorid = users.id) UNION ALL select users.id as
userid, users.username, quizzesTaken.datetaken as date, null, null,
null, quizzesTaken.quizid as quizid, quizzes.name as quizname,
quizzesTaken.score as quizscore FROM quizzesTaken JOIN users ON
(quizzesTaken.userid = users.id) JOIN quizzes ON (quizzesTaken.quizid =
quizzes.id) ) bar where foo.friend2 = bar.userid ORDER BY date DESC
LIMIT 15;