Mailinglisten-Archive |
> -----Original Message-----
> From: Denis Mettler [mailto:taipan_(at)_netcologne.de]
> Sent: Tuesday, April 17, 2001 4:37 PM
> To: mysql-de_(at)_lists.4t2.com
> Subject: Vielleicht ein Join?
>
>
> $sql = "SELECT a.*, b.*, c.CatID FROM links AS a LEFT JOIN
> categorie_zugewiesen as b on a.LinkID=b.LinkID left join
> categorie as c on
> b.CatID=c.CatID";
>
> while ($arrTmp = _(at)_mysql_fetch_array($Query_ID))
> {
> print '<br>'.$arrTmp['Link']; // FeldName wenn eindeutig fuer alle Tbl
> print '<br>'.$arrTmp['CatName']; // oder AS Teil wenn nicht eindeutig
> }
> ?>
>
> So sieht das bei mir aus.
> Er wirft auch im Quellcode die ergebnisse aus,
> mit der ausnahme,
> dass ich den Kategorie Namen (CatName) aus Tabelle c (categorie) nicht
> angezeigt bekomme.
> CatName soll statt CatID angezeigt werden.
Irgendwie logisch, c.CatName sehe ich im SQL-Statement nicht.
SELECT a.*, b.*, c.CatName FROM links AS a LEFT JOIN
categorie_zugewiesen as b on a.LinkID=b.LinkID left join
categorie as c on
b.CatID=c.CatID
PHP => $arrTmp['CatName']
wobei a.*, b.* ist allgemein gesagt schlecht - Du belastest
den Server ohne Grund, weil Du nur Link und CatName ausgibst.
Gruss,
Juri
---
*** Weitere Infos zur Mailingliste und MySQL unter http://www.4t2.com/mysql
php::bar PHP Wiki - Listenarchive