Hello, could somebody kick me into right direction how to build this kind of query in eloquent:
SET @msum := 0;
SELECT t1.*
FROM (
SELECT m.*,
(@msum := @msum + m.amount) AS cumulative_amount
FROM meetings m
WHERE m.type = 'sometype'
ORDER BY m.date ASC
) t1
WHERE t1.cumulative_amount <= 7;
What I want to accomplish is that I will get rows of specific type which sum is equal or less than desired amount. Maybe somebody have complete different idea how to achieve same thing in 'eloquentish' way.
Thank you all for help Tom
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community