Lets say i have a table to store the blogs (table name is blogs) of each user. But also have a table to store the blogs from other users that the user liked (table name is likedBlogs), yes?
so to retrieve them i just do: -Select user's blogs. -Add the blogs he liked.
$q = mysql_query("
SELECT id
FROM blogs
WHERE (iduser = $id)
OR id IN
(SELECT idblog
FROM likedBlogs
WHERE iduser='$id')
AND (id > 0)
ORDER BY id DESC
LIMIT 20
") or die(mysql_error());
Can i do this better? (how would you qualify in performance this query?)
Thanks