feeds_time:
user_id | time
1 | 123123
2 | 1231111
3 | 1233223
...
users_follow
user_id | follow_id
1 | 2
1 | 3
2 | 3
而且表的職位 - 但這不是在這個問題很重要。
其實我的查詢如下:
SELECT `id`, `name`, `user_id`, `time`, 'posts' as `what`
FROM `posts`
WHERE `user_id` IN (SELECT `follow_id`
FROM users_follow WHERE user_id = posts.user_id)
現在,我想添加一個WHERE:WHERE posts.time > feeds_time.time
通過 「電流」 user_id
。
我該怎麼做?
是否有你的理由使用內部'SELECT'語句而不是'JOIN'來指向'fe eds_time'表? – Saggio
沒有具體的原因,它只是我不擅長連接:( – AsG