按照喜欢的日期订购帖子而不是发布的帖子(两个表格)MySql

时间:2016-10-18 23:38:09

标签: mysql join

我有两张桌子

table_posts: id_post | post | date_post
table_likes: id_like | id_post | date_like

我想显示按date_like

排序的帖子

我尝试使用JOIN,但它没有检索phpmyadmin中预期的结果(重复)

SELECT m. * 
FROM table_posts AS m
JOIN table_likes AS p ON p.id_post = m.id_post
WHERE (m.id_post =35 OR m.id_post =36) /*both posts were liked*/
ORDER BY p.date_like DESC 

如何按照喜欢的日期检索订购的帖子?

0 个答案:

没有答案