
Untitled
By: a guest on
May 8th, 2012 | syntax:
None | size: 0.57 KB | hits: 12 | expires: Never
How can I merge these MySQL queries into one or reduce the number of queries (queries in a loop)
SELECT m.id, m.type, m.user_id, m.content, m.date, m.privacy, u.username
FROM messages m, users u WHERE m.user_id=? AND m.author=u.id AND
ORDER by s.date DESC
LIMIT 0, 30
SELECT c.id, c.author_id, c.content, c.date, u.username
FROM comments c, users u
WHERE c.message_id =? AND c.author_id=u.id
ORDER BY c.date ASC
SELECT c.id, c.author_id, c.content, c.date, u.username
FROM comments_to_comments c, users u
WHERE c.comment_id =? AND c.author_id=u.id
ORDER BY c.date ASC