我有以下结构的与会者表找到匹配:如何连接表,包括行,不使用非外键字段
+--------------+---------+
| attendee_id | others1 |
+--------------+---------+
| abcd | B |
| ghij | A |
| defg | C |
+--------------+---------+
而且还与以下结构的eventattendees表:
+--------------+---------+----------+
| attendee_id | others2 | event_id |
+--------------+---------+----------+
| wxyz | D | 1 |
| mlno | E | 2 |
| defg | F | 3 |
+--------------+---------+----------+
我想要的是创建一个查询,给出了一些事项标识,返回一个连接这些表(由attendee_id),而且还返回与没有找到匹配的IDS attenddes参加者表信息的行为那event_id。说,对于event_id 3:
+--------------+---------+---------+----------+
| attendee_id | others1 | others2 | event_id |
+--------------+---------+--------------------+
| abcd | A | null | null |
| ghij | B | null | null |
| defg | C | F | 3 |
+--------------+---------+--------------------+
我该怎么做mysql?
这可以与外部进行连接。 –
我刚才给你提供了以前的数据答案后,你刚刚改变了问题 – Drew
使用更新的答案。我现在得走了。如果您愿意,您可以按任意栏目进行订购。 – Mojtaba