You have a table called Vouchers where you store information about
vouchers, including voucher id (vid) and amount (amt). Run the following
code to create the Vouchers table and populate it with sample data:

SET NOCOUNT ON;
USE tempdb;
GO
IF OBJECT_ID('dbo.Vouchers') IS NOT NULL DROP TABLE dbo.Vouchers;
GO

CREATE TABLE dbo.Vouchers
(
  vid INT NOT NULL PRIMARY KEY,
  amt MONEY NOT NULL
);
GO

INSERT INTO dbo.Vouchers(vid, amt) VALUES(1, 500.0);
INSERT INTO dbo.Vouchers(vid, amt) VALUES(2, 100.0);
INSERT INTO dbo.Vouchers(vid, amt) VALUES(3, 30.0);
INSERT INTO dbo.Vouchers(vid, amt) VALUES(4, 90.0);
INSERT INTO dbo.Vouchers(vid, amt) VALUES(5, 40.0);
INSERT INTO dbo.Vouchers(vid, amt) VALUES(6, 90.0);
GO
Your task is to write a solution that returns all distinct sums of amounts that
can be produced by combining vouchers (one or more). The desired result
for the given sample data is (43 rows):
amt
---------------------
30.00
40.00
70.00
90.00
100.00
120.00
130.00
140.00
160.00
170.00
180.00
190.00
210.00
220.00
230.00
250.00
260.00
280.00
310.00
320.00
350.00
500.00
530.00
540.00
570.00
590.00
600.00
620.00
630.00
640.00
660.00
670.00
680.00
690.00
710.00
720.00
730.00
750.00
760.00
780.00
810.00
820.00
850.00
Cheers,
--
BG