Same field from different records adding to specify amount

G

Guest

I'm not sure if this question should be in the query section or maybe module
coding. I have a table (tbl_cost) that has two fields CC and Cost. I want
to see which record's cost would equal to an amount I specify. For example,
There are 15 records. I'm looking for which records would give me the total
of 10,000 for field Cost. It can be just one record or maybe 4 different
records that will equal to this. thank you for your help
 
J

John W. Vinson

I'm not sure if this question should be in the query section or maybe module
coding. I have a table (tbl_cost) that has two fields CC and Cost. I want
to see which record's cost would equal to an amount I specify. For example,
There are 15 records. I'm looking for which records would give me the total
of 10,000 for field Cost. It can be just one record or maybe 4 different
records that will equal to this. thank you for your help

This is a monstrously complicated NP-Complete problem called "Satisfiability".
You basically have to compare every record with your criterion - then every
possible pair of records - then every possible triplet - then every possible
quartet of records - and so on. The size of the problem is managable with 15
records (only 1307674368000 possible combinations to try) but gets a bit
extreme with more records.

In short... there is NO simple way to do this.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top