I want to select all records from website.advert and join player name from different table also. The query runs itself without any errors, but there is a problem that it does select duplicated records from website.advert when there is more than one record with the same account_id in the player table.
Here is my query:
SELECT `advert`.*, `p`.`name`, `p`.`level`
FROM `website`.`advert`
LEFT JOIN `player`.`player` `p`
ON (`p`.`account_id` = `website`.`advert`.`author_id`)
WHERE `advert`.`accepted` = 0
You need to use
DISTINCTbut I am having trouble figuring out your query. You don’t seem to be selecting any fields fromwebsite.advertSorry, edited:
We are JUST selecting the
idfield for now – try that and see if it gives you closer to the results you are expecting.