我们如何在symfony中编写内连接查询?
$tagQuery = Doctrine_Query::create()
->from('SfTagging t')
->innerjoin('t.Link L ON t.taggable_id=L.id');
echo $tagQuery->getSqlQuery();
答案 0 :(得分:1)
您不需要指定ON部分,如果您的架构不是太糟糕,则doctrine已经知道如何进行连接。我会这样写:
$tagQuery = SfTaggingTable::getInstance()
->createQuery('t')
->innerJoin('t.Link');
echo $tagQuery->getSqlQuery();
答案 1 :(得分:0)
$tagQuery = Doctrine_Query::create()
->from('SfTagging t')
->innerJoin('t.Link l');
echo $tagQuery->getSqlQuery();