Hi All,
DECLARE @example TABLE(ID INT, Amount float)
INSERT INTO @example VALUES(1,100), (2,500), (3,50), (4,200)
select * from @example
DECLARE @Target Float = 600
Now, I need top records where Sum(Amount) = @Target, this target may vary.
Can some please give me a tsql query for this.
thanks!