踩坑系列--mysql查询错误

mysql多表关联查询报了下面的错误:
Column ‘merchant_code’ in where clause is ambiguous
这是因为关联查询的多个表都有同一个字段名,需要加上表限定

如:
select a.name from table a,table b where a.ref_id=b.id and b.name=‘XXX’

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章