...
...
OffTopic:
Code:FROM Tobias t LEFT JOIN Pferde p ON t.id=p.id LEFT JOIN Events e ON t.id=e.id
...
SELECT COUNT() FROM [COLOR=red]tab1 t1[/COLOR] LEFT JOIN tab2 t2 ON t1.spalte1=t2.spalte2 [COLOR=red]LEFT JOIN[/COLOR] tab3 t3 ON t1.spalte1=t3.spalte3
SELECT COUNT(t2.idx) as total FROM idx t2 LEFT JOIN dirs t1 ON t2.IDXdir = t1.idx LEFT JOIN ftps t3 ON t2.IDXftp = t3.idx LEFT JOIN files t4 ON t2.IDXfil = t4.idx WHERE CONCAT(t1.dstring,t4.dstring) REGEXP "test"
EDIT:
wieso hast du schon wieder "LEFT" draußen?
OffTopic:
Ich verstehs auch nicht......
Ein inner join an der richtigen Stelle könnte möglicherweise auch die zu ermittelnden NULL Werte veringern und wäre damit evtl. schneller......
CREATE TABLE `dirs` ( `idx` bigint(20) NOT NULL auto_increment, `dstring` text NOT NULL, PRIMARY KEY (`idx`), FULLTEXT KEY `dstring` (`dstring`) ) TYPE=MyISAM CREATE TABLE `files` ( `idx` bigint(20) NOT NULL auto_increment, `dstring` text, PRIMARY KEY (`idx`), FULLTEXT KEY `dstring` (`dstring`) ) TYPE=MyISAM CREATE TABLE `ftps` ( `idx` int(11) NOT NULL auto_increment, `hos` text, `pos` text, `uss` text, `pas` text, `sch` int(20) NOT NULL default '0', `email` text, `time` int(20) NOT NULL default '0', `dirs` int(20) NOT NULL default '0', `files` int(20) NOT NULL default '0', `upd` int(20) NOT NULL default '0', PRIMARY KEY (`idx`) ) TYPE=MyISAM CREATE TABLE `idx` ( `idx` bigint(20) NOT NULL auto_increment, `IDXftp` bigint(20) default NULL, `IDXdir` bigint(20) default NULL, `IDXfil` bigint(20) default NULL, `IDXsiz` bigint(20) default NULL, `IDXtim` int(11) default NULL, PRIMARY KEY (`idx`), KEY `IDXftp` (`IDXftp`), KEY `IDXdir` (`IDXdir`), KEY `IDXfil` (`IDXfil`) ) TYPE=MyISAM
SELECT COUNT(t2.idx) as total FROM idx t2 LEFT JOIN dirs t1 ON t2.IDXdir = t1.idx LEFT JOIN ftps t3 ON t2.IDXftp = t3.idx LEFT JOIN files t4 ON t2.IDXfil = t4.idx WHERE CONCAT(t1.dstring,t4.dstring) REGEXP "test"
Kommentar