I have a problem to solve;
I have a stock of postage stamps of four different denominations - 1p, 5p, 19p and 27p
Postage is charged in bands:
Second class postage for an item weighing >150g<200g is 54p - the most efficient way to make this up is to use 2x27p stamps
First class postage for the same item costs 72p; one way to make this up would be 1x27p + 2x19p + 1x5p + 2x1p (6 stamps in 4 denominations), but another would be 3x19p + 3x5p (6 stamps in 2 denominations), yet another would be 2x27p + 3x5p + 3x1p (7 stamps in 3 denominations.
Efficiency is here defined as the firstly the least number of stamps and if there is more than one possible solution, the least number of denominations, so the 6 stamps in 2 demoninations solution appears to be the best.
Anyway, I know how I will do it, but I want to know if the SQL I intend to use is non-standard or frowned upon in some way.
Suppose I have two tables:
Table1:
Num
1
2
3
Table2:
Alph
A
B
C
(Using Jet SQL in Microsoft Access), this query:
SELECT Table1.Num, Table2.Alph
FROM Table1, Table2;
Yields the desired result of every possible combination of the two:
Num, Alph
1,A
2,A
3,A
1,B
2,B
3,B
1,C
2,C
3,C
It does so because there is no join specified.
Is this a quirk of Jet SQL (or a quirk of SQL generally), or is it a documented and approved technique? i.e. Am I going to find that an attempt to implement similar techniques on other DB apps fails miserably?
we probably allready spent more time thinking about this and chatting (nice as it has been) than could ever be saved by optimising a rarely used function.