需要将此MySQL查询转换为Laravel 4 DB Fluent

时间:2013-05-18 16:06:53

标签: mysql laravel

这不会转换为Laravel 4 DB Fluent。

$result = $this->database->query("
SELECT     node.title,
           node.title_slug,
           node.item_type,
           node.item_class,
           node.content,
           node.id                   AS id,
           node.lft                  AS lft,
           node.rgt                  AS rgt,
           (COUNT(parent.title) - 1) AS depth
FROM       menuitems                 AS node
           CROSS JOIN menuitems      AS parent
WHERE      node.menu_id   = '$menu_id'
AND        parent.menu_id = '$menu_id'
AND        node.lft BETWEEN parent.lft AND parent.rgt
GROUP BY   node.id
ORDER BY   node.lft
");

需要将其转换为Laravel 4 DB Fluent。

2 个答案:

答案 0 :(得分:0)

我认为问题是,流畅的还没有交叉加入,只有加入和离开加入,你可能想询问是否为下一个beta添加它,或者看看是否有另一种写法它?

答案 1 :(得分:0)

DB::table('table_name')->join('another_table','on_condition_','on_operator','on_condition','cross’)->select(['item1','imtem2'.....]);