SELECT DISTINCT `Tweets`.*
FROM `TweetFollowers`, `Tweets`
WHERE ((`Tweets`.`Poster` = `TweetFollowers`.`MemberID`
AND `TweetFollowers`.`Follower` = '2554')
OR `Tweets`.`Poster` = '2554')
AND `Post` != ''
ORDER BY `Posted` DESC
LIMIT 5;
( SELECT t.*
FROM `TweetFollowers` f, Tweets t
WHERE t.`Poster` = f.`MemberID`
AND f.`Follower` = '2554'
AND `Post` != ''
ORDER BY `Posted` DESC
LIMIT 5
)
UNION DISTINCT
( SELECT t.*
FROM `TweetFollowers` f, Tweets t
WHERE t.`Poster` = '2554'
AND `Post` != ''
ORDER BY `Posted` DESC
LIMIT 5
)
ORDER BY Posted DESC
LIMIT 5;
To assist in analyzing slow SELECTs, please provide
* SHOW CREATE TABLE tbl\G -- Which table has Post and Posted?? Indexes?
* SHOW TABLE STATUS LIKE 'tbl'\G -- sizes
* EXPLAIN SELECT ...\G -- run on your query and mine.
and surround them with [ code ] and [ / code ]