Am 10 Nov 96 19:41:32 schrieb Bill Cheek an All zum Thema
Hi Bill,
BC> I'm suffering from a case of massive brain flatulence and can't for the
BC> life of me, figure out the following dilemma for an ACCESS 95 situation:
BC> Given the following two tables where Table 1 is a list of fruits grown
BC> in a certain county and Table 2 is a list of growers in that county and
BC> their crops:
Use the following SQL statement in the query, using both tables:
SELECT DISTINCTROW Table1.Crop, Table2.Grower
FROM Table1, Table2
WHERE (((Table1.Crop)=[Crop1])) OR (((Table1.Crop)=[Crop2])) OR
(((Table1.Crop)=[Crop3])) OR (((Table1.Crop)=[Crop4])) OR
(((Table1.Crop)=[Crop5]))
ORDER BY Table1.Crop;
The QBE should look like this:
==============================
Field: | CROP | GROWER |
------------------------------
Table: | Table1 | Table2 |
------------------------------
Sort: |Ascending| |
------------------------------
Show: | Yes | Yes |
------------------------------
Criteria:|=[Crop1] | |
------------------------------
Or:|=[Crop2] | |
------------------------------
Or:|=[Crop3] | |
------------------------------
Or:|=[Crop4] | |
------------------------------
Or:|=[Crop5] | |
------------------------------
Be sure NOT! to join the two tables above the QBE grid in any way!
This yields a cartesian product of the two tables, reduced by the criteria.
The only difference to your sample output is that the growers are sorted
ramdomly within a crop group, but even this should be fixable.
Hope to be of help
Kai
Bis dannemann
HacMac
--- FIPS/32 v0.97 W95/NT [M]
---------------
* Origin: Ihre heutige Tube Senf zum Mehl (2:2433/1625.2)
|