踩坑系列--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’

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