开发者

Join 3 tables using Doctrine_RawSql object

Is there any way to make this select:

SELECT * 
FROM `sf_guard_user` 
JOIN `friendship` 
  ON `friendship`.`user_id` = `sf_guard_user`.`id` 
JOIN `circle` 
  ON `friendship`.`circle_id` = `circle`.`id` 
WHERE `circle`.`id` = 1 
ORDER BY `circle`.`id`

with a Doctrine_RawSql o开发者_运维技巧bject without using foreign keys?


Why did you decide to use Doctrine_RawSql?

In this example, I'm using inner join:

SELECT sf.* FROM `sf_guard_user` sf
INNER JOIN `friendship` f on  f.`user_id` = sf.`id` 
INNER JOIN `circle` c on f.`circle_id` = c.`id` 
WHERE c.`id` = 1 
ORDER BY c.`id`
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜