Re: Advanced query issue
- From: "Michel Walsh" <vanderghast@VirusAreFunnierThanSpam>
- Date: Thu, 27 Apr 2006 06:39:47 -0400
Hi,
Can you define what you mean by "linking" the two tables, in this context?
Do you mean to get, as result, a table with 3 columns, A, B, and C, with
records from table a, plus the records in table b not in table a? If any
merge of that kind is involved, you need a UNION query. If this is as I
described, then
SELECT A, B, C FROM tablea
UNION ALL
SELECT b.A, b.B, b.C FROM tableb As b LEFT JOIN tablea As a ON b.A=a.A WHERE
a.A is NULL
would do. Note the second select is the query about finding unmatched
records. I also used UNION ALL, since there is no dup. UNION ALL is faster
than UNION since UNION removes dup, but that is at the cost of extra work.
Hoping it may help,
Vanderghast, Access MVP
"alex" <alex@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CAA97DC8-97F5-4FBD-9C6A-8266BFB164BF@xxxxxxxxxxxxxxxx
Hail all,
Suppose we have 2 tables (20 rows each) as follows:
Table a with Columns A, B and C and an Index
Table b with Columns A, B and C and an Index
Columns A & B contain numbers. A ranges from 1 to 50 while B ranges from 1
to 1000. Column C contains words.
Each record in Table A matches uniquely another record in Table B. At the
moment there is no link between the tables.
The question is how to link the 2 tables.
If we run a select query (per table) Grouping by A & B and Count the C's,
this count is identical to both tables. i.e. the data essentialy is the
same.
So the query that i though of is Group by A & B and sort Alphabetically
the
C's. Then copy one index to the other, thus linking the two tables.
But i can't make it happen..
any suggestions much appreciated.
.
- Follow-Ups:
- Re: Advanced query issue
- From: Alexankius
- Re: Advanced query issue
- Prev by Date: Re: Query Help
- Next by Date: Passing Excel Data into Access queries
- Previous by thread: help
- Next by thread: Re: Advanced query issue
- Index(es):
Relevant Pages
|