为什么此查询返回重复 ID 错误?我正在使用 php
SELECT DISTINCT * FROM products as prd
LEFT OUTER JOIN (SELECT DISTINCT * FROM product_aliases) AS product_aliases
ON product_aliases.product_id = prd.id
AND product_aliases.alias = '$alias'
LEFT OUTER JOIN (SELECT DISTINCT * FROM product_images as prdim
LEFT OUTER JOIN product_image_votes as prdimvt
ON prdimvt.product_image_id = prdim.id) AS productimages
ON productimages.product_id = prd.id
WHERE prd.id = $id
错误:
数据库错误错误:SQLSTATE [42S21]:列已存在:1060 列名“id”重复 SQL 查询:SELECT DISTINCT * FROM products as prd LEFT OUTER JOIN (SELECT DISTINCT * FROM product_aliases) AS product_aliases ON product_aliases.product_id = prd.id AND product_aliases.alias = 'Pringles The Original' LEFT OUTER JOIN (SELECT DISTINCT * FROM product_images as prdim LEFT OUTER JOIN product_image_votes as prdimvt ON prdimvt.product_image_id = prdim.id) AS productimages ON productimages.product_id = prd.id WHERE prd.id = 1