The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Apr 15, 2012 8:43 pm 
Joomla! Explorer
Joomla! Explorer

Joined: Sun Jun 22, 2008 4:25 pm
Posts: 358
I am trying to do something like

Code:
$query = "SELECT #__mycomponenttable1.*
                 FROM #__mycomponenttable1
                 LEFT JOIN #__mycomponenttable2
                 ON #__mycomponenttable2.tableid1=#__mycomponenttable1.id
LEFT JOIN #__mycomponenttable3
                 ON #__mycomponenttable3.tableid2=#__mycomponenttable2.id
                 WHERE #__mycomponenttable1.id = '" . JRequest::getVar('id', 0, '','int') . "'";


and lets say that I get 2 results from table 2 and 3 results from table 3, how do I output all the results??

I don´t know if I write the query the right way or not, but...

the structure of results should look something like

table1 result
-table2 result1
--table3 result1
--table3 result2
-table2 result2
--table3 result3
--table3 result4


Top
 Profile  
 
PostPosted: Sun Apr 15, 2012 10:34 pm 
Joomla! Ace
Joomla! Ace

Joined: Sat Oct 01, 2011 7:06 pm
Posts: 1260
That is correct. The results are:

table1 result
table1 result
table1 result
table1 result
table1 result
table1 result

Put attributes of table2 and table3 on you select list:
table1 result table2 result1 table3 result1
table1 result table2 result1 table3 result2
table1 result table2 result1 table3 result3
table1 result table2 result2 table3 result4
table1 result table2 result2 table3 result5
table1 result table2 result2 table3 result6


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 



Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group