Re: Which column is taken in JOIN with multiple columns and different content ?



On 02 Mar 2007 16:07:59 GMT, merlin@xxxxxxx (Tobias Merler) wrote:

Assume I join two tables.
Both of these tables contain a column with name "col1". This column ist not he primary key.
However this column contains different values which value is taken ?

Lets see the following example:

Select *
FROM tablea a, tableb b
Where a.id = b.id

tablea:

id col1 col2

1 aaa ddd
2 bbb eee
3 ccc fff


tableb:

id col1 col3

1 zzz uuu
2 xxx vvv
3 yyy www

The result table will look like:

id col1 col2 col3

1 ??? ddd uuu
2 ??? eee vvv
3 ??? fff www

Which values will be for the questions marks ?

Ok, I know the data model is not perfect and the two tables could be merged.
But keep in mind that the sample is only a simplified version of a more complex
SQL statement. So lets concentrate on my question.

Thank you

Toby


You have output from a SELECT and a 'result table', but you say
nothing about connecting the two. Could you please provide the code
you are intending to use to fill the table from the output?

Jaap.
.



Relevant Pages

  • Re: How to trim a record when using DB_OPEN_TABLE
    ... and TableB contains some items that need to be updated in TableA. ... EmplID ... QtrDate (primary key) ...
    (microsoft.public.access.modulesdaovba)
  • Re: sql minus
    ... What do you do in the case of a composite primary key? ... FROM TableA LEFT JOIN TableB ... SELECT * FROM TableA MINUS SELECT * FROM TableB; ...
    (microsoft.public.access.queries)
  • Re: Subselect Query Problem
    ... tableA LEFT JOIN tableB ... the result (of the inner join), it is logically re-introduced into the ... result, but since nothing match in tableB, whatever comes from tableB is ... > is Table B that has the first three fields as the primary key, ...
    (microsoft.public.access.queries)
  • Re: How to trim a record when using DB_OPEN_TABLE
    ... QtrDate (primary key) ... Right now, I am taking the first record in TableB, searching TableA for a ... there are extra spaces at the end of some data in the TableA.EmplID. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Which column is taken in JOIN with multiple columns and different content ?
    ... FROM tablea a, tableb b ... Which values will be for the questions marks? ... So lets concentrate on my question. ...
    (comp.databases.oracle.misc)