mysql query with join repeats results

Tony33

i have this query:

select distinct eventi.img as eventi,prodotti.img as prodotti
from eventi
JOIN prodotti WHERE eventi.homepage = prodotti.homepage

that returns this result: phpmyadmin screenshot

As you can see, i have 3 events and it's ok, but i have only 1 product and it's repeated 3 times. How do i get the products result not repeated? Even if it's possible to group all results in a single column.

Alex
SELECT DISTINCT eventi.img as img
FROM eventi
WHERE homepage = 1
UNION
SELECT DISTINCT prodotti.img 
FROM prodotti 
WHERE homepage = 1

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related