c_mart_order_info 表执行
mysql> SELECT order_id,order_sn FROM `c_mart_order_info` WHERE `order_sn` = '16030515100000196809';
+----------+----------------------+
| order_id | order_sn |
+----------+----------------------+
| 27 | 16030515100000196809 |
+----------+----------------------+
1 row in set (0.00 sec)
c_order_pay 执行
mysql> select order_sn from c_order_pay where order_sn=16030515100000196809;
+----------------------+
| order_sn |
+----------------------+
| 16030515100000196809 |
+----------------------+
1 row in set (0.00 sec)
两个表 left join 后
mysql> select a.order_sn as a_sn,c.order_sn as c_sn from c_mart_order_info as a left join c_order_pay as c on a.order_sn=c.order_sn where a.order_id=27;
+----------------------+------+
| a_sn | c_sn |
+----------------------+------+
| 16030515100000196809 | NULL |
+----------------------+------+
1 row in set (0.00 sec)
两个表都有相同的 order_sn 用left join 查询,为什么只得到一个表的信息,哪里出错了?
------更---------
感谢 woderwang 提醒,我的mysql 版本是5.1,col类型不一样造成,但是某些更新版本的mysql,却没有这个问题,