This should be simple, but I can't work it out without cursors.
I have a table with quantity field. I want to get all first rows
whose sum of quantity matches defined value.
No Quantity
=============
1 50
2 50
3 80
4 80
5 80
6 50
If defined value is, lets say, 180, query should return rows 1..3
Something like
select *
from table
where sum(quantity) = 180
order by No
Any way to work this out?
Thanks,
Mario B.