下面给出的是我想在Cakephp中转换的查询,有人能帮我吗.
SELECT S.name, (sum(El.amount) - (EE.total - EE.Returned_equipment)) As "Leftover", EE.equipment_id, sum(EL.amount), EQ.type
From States S
Inner Join events EV ON S.id = EV.state_id
Inner Join equipment_events EE ON EE.event_id = EV.id
Inner Join equipment_locations EL On EL.equipment_id = EE.equipment_id
Inner Join equipment EQ On EQ.id = EE.equipment_id
Inner Join events E2 ON E2.location_id = EL.location_id
Inner Join locations L On L.state_id = S.id
Where EE.Bool_value = "Open" Group BY EE.equipment_id, S.name
1条答案
按热度按时间xzabzqsa1#
在CakePHP 3中,请尝试以下操作:
并念道:
https://book.cakephp.org/3/en/orm/query-builder.html