寻呼机表
+----+-------------+
| id | content |
+----+-------------+
| 1 | bank |
| 2 | invalid |
| 3 | cat |
+----+-------------+
页表
+-----------+--------------------+
| page_id | content |
+-----------+--------------------+
| 1 | people |
| 3 | saved |
+-----------+--------------------+
希望结果为
+-----------+--------------------+---------------+
| id | content | page_content |
+-----------+--------------------+---------------+
| 3 | cat | null |
+-----------+--------------------+---------------+
答案 0 :(得分:0)
SELECT a.id, a.content, b.content AS page_content FROM page a JOIN pager b WHERE a.id = 3
输出将是:
+-----------+--------------------+---------------+
| id | content | page_content |
+-----------+--------------------+---------------+
| 3 | cat | saved |
+-----------+--------------------+---------------+