[TYPO3-dev] Joining table with Typo3 ?

Yannick ypavard at infoglobe.ca
Fri Dec 30 19:32:38 CET 2005


Elmar Hinz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
>> 
>> Typo3 with DBAL don't use ALIAS for example :  mytable as my
>> 
>> See  :
>>
http://typo3.org/documentation/document-library/doc_core_cgl/Other_guidelines/
>> 
> 
> Are you sure?

not sure ;)

> I don't read there not to use ALIAS for tables. They rather say prepend
> a tablename  (or table-alias?) to the fieldname. 
> If you join *table_a* and *table_a* both with a *uid*, don't use simply
> *uid* because that is not uniqe.
> Use: table_a.uid, table_b.uid instead.
> Or with ALIAS: table_a AS ta, table_b AS tb
> Use: ta.uid, tb.uid
> Regards
> Elmar

Ok It's right now.. because there was a error in my request ;)

There is my code now : 

$where = sprintf("p.uid=f.programme AND f.uid=c.fiche_id AND 
                                        f.uid = %d", 
                                        $this->piVars[f]
);
$sql = $db->exec_SELECTquery('f.nom_fiche, c.bodytext, p.nom',
'tx_mccfiche_fiches AS f, tx_mccfiche_programme AS p, tx_mccfiche_contenu AS
c',$where);
$InfosFiche = $db->sql_fetch_assoc($sql);

Thank you very much !

A+
> 
> 
> - --
> Climate change 2005: Mexico, Guatemala, New Orleans, Sahel, Bangladesh,
> Spain, Portugal, Austria, Swiss, France, ...
> Production of CO2 is killing people.
> Production of CO2 just for fun is killing people just for fun.
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> 
> iD8DBQFDtWmwO976RNoy/18RAlVXAJ9NpB2fEslpuhyoFRaL/+MOMUkYVwCeNYFO
> +fsu9ZFP7UTpX8UYiZuFj5A=
> =GRzc
> -----END PGP SIGNATURE-----





More information about the TYPO3-dev mailing list