Problem in Union Join For MySQL Query
Posted
by Mac Taylor
on Stack Overflow
See other posts from Stack Overflow
or by Mac Taylor
Published on 2010-06-03T14:48:59Z
Indexed on
2010/06/03
14:54 UTC
Read the original article
Hit count: 217
hey guys
i managed to select from a table that saves my latest posts
but i need to have double condition in selection
here is my code :
$sql_query = "SELECT b.*,u.username AS MY_Sender
FROM TABLE_users u,TABLE_blogs b
Where b.reciever = '0' AND u.user_id = b.sender
UNION
SELECT b.*,u.username AS MY_reciever
FROM TABLE_users u,TABLE_blogs b
Where b.reciever != '0' AND u.user_id = b.reciever
ORDER BY bid DESC
LIMIT 0,7 ";
but MY_reciever is Null and empty
Am i wrong in using UNION for this need ?!
© Stack Overflow or respective owner