日期:2014-05-16 浏览次数:21087 次
mysql> delete from t2 where id = 5;
Query OK, 1 row affected (0.00 sec)
mysql> delete from t1 where id = 4;
Query OK, 1 row affected (0.00 sec)
mysql> select t1.*,t2.* from t1 left join t2 using(id) union all select t1.*,t2.* from t1 right join t2 using(id);
+------+---------+------+---------+
| id | game_id | id | game_id |
+------+---------+------+---------+
| 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 6 |
| 5 | 6 | NULL | NULL |
| 6 | 8 | 6 | 4 |
| 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 6 |
| NULL | NULL | 4 | 8 |
| 6 | 8 | 6 | 4 |
+------+---------+------+---------+
10 rows in set (0.00 sec)
mysql>