MySQL: Left join and column with the same name in different tables?

前端 未结 6 637
别那么骄傲
别那么骄傲 2020-12-03 22:10
SELECT * FROM `product` left join category on product.category_id = category.id

This query works fine. But the problem is, both the product table a

6条回答
  •  [愿得一人]
    2020-12-03 22:44

    use the "AS" keyword like

    SELECT product.id AS pid, category.id AS cid ... FROM `product` left join category on product.category_id = category.id
    

提交回复
热议问题