I've been trying to join all the rows from two different tables. I've tried UNION and LEFT JOIN.
Right now I've just been using two separate queries and had one display after the other. I would like to merge the two queries to display at the same time.
table 1 is called 'approves' and table 2 is called 'comments'.
批准
- id
- postID
- postUserID
- userID评论
- id
- postID
- postUserID
- 用户 ID
- 评论
- 日期
这是一个 UNION 的例子
select id, postID, postUserID, userID, comment, date from comments
union
select id, postID, postUserID, userID, null, null from approves
Run Code Online (Sandbox Code Playgroud)