MySQL Forums
Forum List  »  German

Re: Schlechte Performance WHERE JOIN
Posted by: Torsten Egeler
Date: January 23, 2014 03:32AM

Da diese Abfrage hier nur ein vereinfachtes Beispiel ist, muß ich dieses nochmal verbessern. Ich habe herausgefunden, dass die "Bremse" der JOIN mit dem ALIAS ist
weil praktisch diese Tabelle 2 x eingebunden ist.

Es wird also der Artikel gesucht und aus tabelle2 wird noch der Hinweistext benötigt, sofern die kennung "a" ist.


SELECT DISTINCT artikel.*,hinweis.text FROM artikel

LEFT JOIN tabelle2 ON tabelle2.artikel_id = artikel.id
LEFT JOIN tabelle2 ON tabelle3.artikel_id = artikel.id
LEFT JOIN tabelle2 AS hinweis ON hinweis.artikel_id = artikel.id AND hinweis.kennung = 'a'

WHERE artikel.name LIKE "%Suchbegriff%"
OR tabelle2.text LIKE "%Suchbegriff%"
OR tabelle3.text LIKE "%Suchbegriff%"



Edited 1 time(s). Last edit at 01/23/2014 03:34AM by Torsten Egeler.

Options: ReplyQuote


Subject
Views
Written By
Posted
1548
January 23, 2014 02:29AM
Re: Schlechte Performance WHERE JOIN
748
January 23, 2014 03:32AM


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.