0
SELECT Inventory_Stock.id, Inventory_Stock.quantity, SUM(InventoryUsage.quantity)
,Inventory_Stock.quantity - SUM(InventoryUsage.quantity) AS Stock
FROM Inventory_Stock LEFT JOIN InventoryUsage ON Inventory_Stock.id = InventoryUsage.InventoryStock_id
WHERE Inventory_Stock.id = 26 OR
Inventory_Stock.id = 27
GROUP BY Inventory_Stock.id
ORDER BY Stock Asc
我怎麼能寫的Symfony2上面的代碼,我想把它寫成原始查詢寫作Symfony2的原始查詢,並把它傳遞給pagefanta爲分頁
而且我使用PageFanta爲分頁..所以上述查詢的結果將轉到分頁。
的關係是:
產品(1 - 1)InventoryStock InventoryStock(1 - N)InventoryUsage