我有这个问题:
select distinct eventi.img as eventi,prodotti.img as prodotti
from eventi
JOIN prodotti WHERE eventi.homepage = prodotti.homepage
返回此结果: phpmyadmin screenshot
正如你所看到的,我有3个活动,没关系,但我只有1个产品,它重复了3次。如何获得不重复的产品结果? 即使可以将所有结果分组到一列中。
答案 0 :(得分:0)
SELECT DISTINCT eventi.img as img
FROM eventi
WHERE homepage = 1
UNION
SELECT DISTINCT prodotti.img
FROM prodotti
WHERE homepage = 1