MySQL Forums
Forum List  »  German

Re: Newbie Frage: 2 Tabellen JOIN - Denkfehler?
Posted by: Marco Schöling
Date: March 03, 2023 02:53AM

ja, es war dann doch ganz einfach mit GROUP BY...

Jetzt gehts:
SELECT a.artikelid, a.kurzbezeichnung, af.dateiname
FROM tf_artikel a
LEFT JOIN tf_artikelfotos af ON a.artikelid = af.artikelid
WHERE a.kurzbezeichnung LIKE '%trainingsanzug%'
AND a.artikelstatusid = 2
GROUP BY artikelid
ORDER BY artikelid DESC
LIMIT 100

Ich fand dazu auch diese Diskussion sehr aufschlussreich:
https://stackoverflow.com/questions/45588672/forcing-left-join-to-only-return-one-row-from-matching-ids-in-the-right-table

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Newbie Frage: 2 Tabellen JOIN - Denkfehler?
79
March 03, 2023 02:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.