# Database Discussions > Microsoft SQL Server 2005 >  A query to find the best matched group

## amitmca

I have got a really complext query to write. 
I have got an ITEM table that contains items with different price and I have to find the items from the table that makes up an order of particular amount.

ITEM TABLE
ID    PRICE
1       1.00
2       1.00
3       1.15
4       1.20

Now when order amount is 2 it should return item 1 & 2. 
when order amount is 1.15, it should return item 3
when order amount is 1.20, it should return item 4
when order amount is 2.15, it should return item 2 & 3
when order amount is 3.35, it should return item 2, 3 & 4.

Order amount can be anything. Any help would be highly appreciated.

----------

