有2个表
t1 :
uid name
----------------
1 tom
2 marry
t2:
uid goods
--------------------
1 fruit
1 notebook
2 car
1 clothes
3 box
select count(*) from t1 left join t2 on t1.uid = t2.uid
结果竟然比t1的总数还多?
这是因为,uid在t1表里是唯一的,但在t2表不是唯一的,所以t2里面能与t1匹配的每一行都会复制一行:
uid name goods
1 tom fruit
1 tom notebook
2 marray car
1 tom clothes