Join two tables 
Author Message
 Join two tables

Hi,

Is it possible to join two tables so that the number of
the fields of the result will be the sum of that of the
two tables? Assume that there is no relationship between
the two tables and we can retrieve the same rows from two
tables.

For example:

Table1
AAA  1
BBB  2

Table2
CCC  3
DDD  4

Result will be:

AAA  1  CCC  3
BBB  2  DDD  4

This kind of join is neither Inner Join nor Outer Join. I
have not found a solution.

Any suggestion and ideas will be greatly appreciated.

Thanks

Andy  



Mon, 13 Sep 2004 01:20:51 GMT  
 Join two tables
A "join" is based on a relationship between two tables, which you don't
have. If you specify a join without describing the relationship (Select *
From Table1, Table2) then you get a cross product, which is every row in one
table paired up with every row in the other table.

AAA 1 CCC 3
AAA 1 DDD 4
BBB 2 CCC 3
BBB 2 DDD 4

Not sure how to get your exact results without tweaking the tables or using
some code.


Quote:
> Hi,

> Is it possible to join two tables so that the number of
> the fields of the result will be the sum of that of the
> two tables? Assume that there is no relationship between
> the two tables and we can retrieve the same rows from two
> tables.

> For example:

> Table1
> AAA  1
> BBB  2

> Table2
> CCC  3
> DDD  4

> Result will be:

> AAA  1  CCC  3
> BBB  2  DDD  4

> This kind of join is neither Inner Join nor Outer Join. I
> have not found a solution.

> Any suggestion and ideas will be greatly appreciated.

> Thanks

> Andy



Mon, 13 Sep 2004 02:34:28 GMT  
 Join two tables
Try the UNION Statement

(SELECT Field1, Field2 FROM Table1)
UNION
(SELECT Field1, Field2 FROM Table2)

This will only show completely unique rows so if you
expect duplicates, you'll need to add another field for
uniqueness purposes.

Hope this helps,
justin./

Quote:
>-----Original Message-----
>Hi,

>Is it possible to join two tables so that the number of
>the fields of the result will be the sum of that of the
>two tables? Assume that there is no relationship between
>the two tables and we can retrieve the same rows from two
>tables.

>For example:

>Table1
>AAA  1
>BBB  2

>Table2
>CCC  3
>DDD  4

>Result will be:

>AAA  1  CCC  3
>BBB  2  DDD  4

>This kind of join is neither Inner Join nor Outer Join. I
>have not found a solution.

>Any suggestion and ideas will be greatly appreciated.

>Thanks

>Andy  
>.



Mon, 13 Sep 2004 05:21:29 GMT  
 Join two tables
I would add relationship by adding AutoNumber Column(MS Access) or
Identity(SQL Server)
to both tables.

After Join them you can drop this column.


Quote:
> Hi,

> Is it possible to join two tables so that the number of
> the fields of the result will be the sum of that of the
> two tables? Assume that there is no relationship between
> the two tables and we can retrieve the same rows from two
> tables.

> For example:

> Table1
> AAA  1
> BBB  2

> Table2
> CCC  3
> DDD  4

> Result will be:

> AAA  1  CCC  3
> BBB  2  DDD  4

> This kind of join is neither Inner Join nor Outer Join. I
> have not found a solution.

> Any suggestion and ideas will be greatly appreciated.

> Thanks

> Andy



Mon, 13 Sep 2004 07:05:04 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Joining two tables from two databases

2. Here's a sticky wicket - joining two tables on two diffrent servers with ADO

3. Joining two tables from different databases

4. How to Join two tables thrice?

5. Joining two tables on different length fields

6. Join two tables from seperate databases

7. joining two tables from different dbs

8. Join two tables

9. Joining two tables from different dbs

10. VB? how to inner join two tables in two MS Access database

11. Urg:It is possible to join two tables from two different databases ?

12. Table join between two tables in different databases

 

 
Powered by phpBB® Forum Software