Possible Duplicate:
every derived table must have its own alias
Halo i am trying to get a table record in away that it can show the result by combining two results of one table.. here in my table 'updatez' i am storing all updates from users (friends table store the user accessibility on friends) and changers (changer table store the user accessibility on changer) into this table.... here i am wanted to display all friends and changer updates (if they are approved) by sorting the created time and order 0,5...
is there any other easier solution to do this the code i was trying
SELECT *
FROM (
SELECT M.updt_id AS updt_id,
M.user_id_fk AS user_id_fk,
M.updates AS updates,
M.created AS created,
M.uploads AS uploads
FROM updatez M
WHERE updatez.user_id_fk = friends.friendA
AND friends.friendB = $USER
UNION
SELECT A.updt_id AS updt_id,
changer_id_fk AS changer_id_fk,
A.updates AS updates,
A.created AS created,
A.uploads AS uploads
FROM updatez A
WHERE updatez.changer_id_fk = changer.changer_id
AND changer.user_id = $USER
)
ORDER BY created DESC
LIMIT 0, 5
any kind of help would be appreciate.. thanx in advance Tim