Let's said I have a table with an id column and an amount column. I want to select the first n records that adds up to certain amount, say 100. Something similar to the SQL below:
select id, amount from table order by id limit sum(amount) < = 100
Anyway to do it with SQL?
select id, amount from table order by id limit sum(amount) < = 100
Anyway to do it with SQL?