【发布时间】:2021-12-26 16:36:57
【问题描述】:
我编写了一个原始查询,其中还包含子查询。我不知道如何使用查询生成器转换 laravel 子查询中的子查询。 请有人转换此查询。这将是非常可观的。
查询:
SELECT inventory.EmployeeID,
inventory.created_date AS OrderDate,
SUM(inventory.calculation) AS TotalPrice
FROM ( SELECT i.id AS ItemID,
o.id AS OrderID,
o.EmployeeID,
o.created_date,
(o.Quantity * i.price) AS calculation
FROM `stationary_orders` AS o
LEFT JOIN `stationary_items` AS i ON o.Stationary_ID = i.id
WHERE o.Store IN $storess
ORDER BY o.id DESC
LIMIT $Limit,10 ) AS inventory
GROUP BY inventory.EmployeeID
【问题讨论】:
-
请参考此链接。 itsolutionstuff.com/post/…
-
@RaviDamasiya 我已经浏览过这个包含原始查询的链接