Autor Beitrag
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Mi 27.04.05 10:52 
Ich hab folgendes Statement
ausblenden Quelltext
1:
SELECT cur_title FROM cur WHERE cur_is_redirect > 0 AND NOT( cur_id in (SELECT cl_from FROM categorylinks))					


Wie löse ich den so auf dass er unter MySQL funktioniert ?

_________________
mfg. Joel
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 27.04.05 11:14 
Ich meine, dass die neueste Version von mySQL auch Sub-Selects kann.
Evtl. benötigst du ein Update.
JoelH Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Mi 27.04.05 11:43 
Titel: hmm,
user profile iconjasocul hat folgendes geschrieben:
Ich meine, dass die neueste Version von mySQL auch Sub-Selects kann.
Evtl. benötigst du ein Update.


Ist aber leider nicht meiner :(

_________________
mfg. Joel
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 27.04.05 12:00 
ausblenden Quelltext
1:
2:
3:
4:
SELECT cur_title FROM cur, categorylinks
WHERE cur_is_redirect > 0 
AND  cur_id(+) = cl_from
and cur_id is null

Mal so auf die schnelle als Idee. Obs so funktioniert weiß ich nicht, da ich mit Oracle arbeite und Sub-Selects machen darf.
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Mi 27.04.05 12:40 
Ich würd das über nen LEFT JOIN lösen, weil Sub-Selects mitunter (Je nach Qualität des Profilers) langsamer sind:

ausblenden Quelltext
1:
2:
3:
4:
5:
SELECT cur_title FROM cur 
   LEFT JOIN categorylinks ON cur.cur_id=categorylinks.cl_from

WHERE cur_is_redirect > 0 AND 
   cetegorylinks.cl_from IS NULL


Das was jasocoul geschrieben hat ist an sich auch richtig, dürfte aber erheblich langsamer laufen (zumindest bis mySQL 4.0), weil er durch die zwei Tabellen in der FROM-Clause zuerst ein kartesisches Produkt baut und erst auf Grund dessen das WHERE-Statement ausführt. Dagegen wird bei einem LEFT JOIN nur das effektive Produkt aufgebaut und dann das WHERE-Statement ausgeführt.

@Jasocoul: Oracle hat nen geilen Profiler, der von mySQL ist bis 4.0 leider immer noch grottenschlecht :-)

Viele Grüße,

Matthias

_________________
Ha! Es compiliert! Wir können ausliefern!
JoelH Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Mi 27.04.05 14:26 
Titel: hmm,
supi neojones, genau was ich gesucht habe. Ist perfekt, auch wenn mir dieses "is NULL" suspekt vorkommt ;)

_________________
mfg. Joel
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 27.04.05 14:55 
user profile iconneojones hat folgendes geschrieben:
@Jasocoul: Oracle hat nen geilen Profiler, der von mySQL ist bis 4.0 leider immer noch grottenschlecht :-)


Bin halt verwöhnt. 8)