Firstly, I've just noticed a mistake in qry1; it should be:
SELECT
P1.Player AS Player1, P2.Player AS Player2, P2.Rank AS Rank2
FROM Players AS P1, Players AS P2
WHERE P1.Location <> P2.Location
AND P1.Rank < P2.Rank;
Open your database and go to the Queries page of the main database window.
Double click on 'Create query in Design View'. This brings up the 'add
table' dialogue which you can close without doing anything in it. Then from
the View menu select SQL View. The SQL window will just have SELECT; in it.
Copy the SQL for qry1 from above and paste it into the SQL window in place of
what's there. You then need to change the names of the table and fields in
the SQL to your own; I've assumed the table's called Players and the fields
are called Player, Location and Rank, so change all these in the SQL to
whatever your table and fields are actually called. Remember that if a table
or field name includes spaces or other special characters such as the # sign
you need to wrap the name in square brackets, e.g. [Players List] or [Rank#].
If in doubt put brackets around the table and field names regardless. Don't
change any of the 'aliases', though; they are the names following the AS
keyword or the abbreviated alias table names P1, P2 before the field names.
When you've done this switch to datasheet view to check that it works. If
its OK you'll get a very large number of pretty meaningless combinations of
players, but don't worry about that; this query is just the first stage and
you won't need to open it at all once the other two are set up. save it as
qry1.
Repeat the above for qry2 and qr3, but this time you don't need to change
any table or field names as the ones used in these queries' result sets are
the names given to them as aliases in qry1 by the AS keyword. Open qry2 once
you've designed it to test it. This will return less rows that qry1, but
they still won't make much sense. qry3 is the only one you'll need to open
to get the final pairings of players. If it doesn't do as hoped post back as
I can easily set up a table and insert some dummy data to test, and hopefully
debug, the queries.
Ken Sheridan
Stafford, England
Chad said:
I'm not very familiar with Access, can you help me with setting this up? We
can just use generic data. I can make some up if you like. Thanks for the
feedback.