Hi, thanks for your help in advance.
Given is one HUGE table of items (I get the table by the customer and have no influence on it's structure)
ITEMTYPE | MATERIAL | DIAMETER | PRICE
Now I have to make a catlogue with one page for each item type like:
TYPE A:
DIAMETER | MATERIAL1-PRICE | MATERIAL2-PRICE | [...] | MATERIAL 7-PRICE
Currently i do:
QUERY1: SELECT diameter, price FROM Table WHERE itemtype = "A" and material = "1"
QUERY2: SELECT diameter, price FROM Table WHERE itemtype = "A" and material = "2"
[...]
QUERY7: SELECT diameter, price FROM Table WHERE itemtype = "A" and material = "7"
and then a connecting query like:
SELECT query1.diameter, query1.price, query2.price, [...] query7.price
FROM query1
INNER JOIN query2 ON query1.diameter = query2.diameter
INNER JOIN query3 ON query1.diameter = query3.diameter
[...]
INNER JOIN query7 ON query1.diameter = query7.diameter
This works pretty fine so far, but for each itemtype I need to build (and maintain) 8 SQL-queries (or 1 giant SQL monster). I have like 100 item types :-)
Is there a way to have a parametrized query like
SELECT diameter, price WHERE itemtype = $ITEMTYPE and material = $MATERIAL
and to call this from the connecting query so I have only 100 different queries but not 800?
Additional problem: The queries are called through ODBC from outside access, so I cannot do VB magic :-)
Thanks and best regards
Martin