Forums

Join condition syntax

FloB 29 Jul, 2015
Hello,

I'm trying to create a relation between 2 tables with a DBRead action but I have syntax problem with the join condition.

I want to join my table _content (as articles, set in basic section) with another table (as phoca, set in relations section). The join must be done with this relation : `articles`.`alias`=`phoca`.`alias`

I have put this in the join condition :
<?php
return array('`articles.alias`' => '`phoca.alias`');
?>

But the result is :
LEFT JOIN `xxx_phocagallery_categories` AS `phoca` ON `articles`.`alias` = '`phoca.alias`'

Seems to me that the quote aren't good for the second part, but don't know what to put in the array to make it work.

I know how to built it with Joomla methods in a custom code, but there is a nice box to do this, so I want to use it. If Max or Bob spend some time to make it, it's worth not using it :-) Just need some explanations...

Somebody could help me please?

Regards
Florence
GreyHead 29 Jul, 2015
Hi Florence,

I;m not sure what the right answer is without researching but to start with please try without any back-ticks.
<?php
return array('articles.alias' => 'phoca.alias');
?>

Bob
FloB 29 Jul, 2015
Hi Bob,

Result :
LEFT JOIN `xxx_phocagallery_categories` AS `phoca` ON `articles`.`alias` = 'phoca.alias'

So it's not working...

Regards,
Florence
FloB 30 Jul, 2015
Answer
1 Likes
Hello,

Sorry for the disagrement, the answer was in the FAQ :
<?php
return array(":articles.alias = phoca.alias");
?>


Regards
Florence
This topic is locked and no more replies can be posted.