[Typo3-dev] mysql two table select...
Marek Meyer
Marek.Meyer at gmx.de
Tue Feb 3 17:13:08 CET 2004
Hi Gabriel,
Try something like this:
"SELECT table1.title, ..., table2.title AS title2 FROM ..."
Then you can address both fields in PHP.
Marek Meyer
-----Original Message-----
From: typo3-dev-bounces at lists.netfielders.de
[mailto:typo3-dev-bounces at lists.netfielders.de] On Behalf Of Gabriel
Anast
Sent: Tuesday, February 03, 2004 5:04 PM
To: typo3-dev at lists.netfielders.de
Subject: [Typo3-dev] mysql two table select...
This is probably a mysql or PHP question, but I'll try here first... I
am
modifying a php file to make the select that I need, and it is a two
table
SELECT in which I use a column from each table that has the same name:
$query = "SELECT tt_news.title,tt_news.short, " .
"tt_news_cat.tx_spnewscatimgs_image,tt_news_cat.title " .
"FROM tt_news, tt_news_cat " .
"WHERE tt_news.category = tt_news_cat.uid " .
"AND tt_news.pid=" .$datapid .
$this->cObj->enableFields("tt_news") .
$requiredparams .
" ORDER BY tt_news.uid LIMIT " .$row .",1";
notice that two columns are being selected that are named "title", one
from
tt_news, and one from tt_news_cat. The end result is that in $content
both
fields that come from the columns named "title" are filled with the
value that
comes from the second table.
Why is this, and is there some way I can modify the SQL or the PHP to
specify
the fileds that I want filled with the SELECT?
--gabe
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
Typo3-dev mailing list
Typo3-dev at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
More information about the TYPO3-dev
mailing list