Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Join unmatched colums

Status
Not open for further replies.

kelele

Programmer
May 22, 2001
12
US
Please show me how to do this if at all possible.

I have to tables with the following fields and data:

TABLE1
UniqueID1 Tracking Description1
1 101 A
2 101 B
3 101 C

TABLE2
UniqueID2 Tracking Description2
7 101 X
8 101 Y


The two tables are not related in any way at all other than by the "Tracking" field.
I need to join the two tables such that the two descriptions fields appear side by side this way:

Tracking description1 description2
101 A X
101 B Y
101 C NULL

- No need to be ordered in any specific way.
- The number of matching records in either table could be
greater than in the other table or
they could be the same number.
- Tracking 101 is one instance of the join. Multiple Tracking numbers exist in the two tables that need to be joined in the same way.

thanks,

Kelele

 
Hi Kelele, I can't think of an easier way of doing this if I do then I'll post it here.You could try implementing the following logic. I don't know how large your data is or whether the data in table3 is for viewing purposes only or is set for editing therefore some issues such as speed etc may be compromised.
Each time fresh data is required, first run a delete all query against table3. Then run a union select ALL query against the tracking number of tables 1 and 2. Append this data to table3's Tracking field? Then run code/query to update Table3.description1 with data from Table1.description1 where the tracking numbers match. Next step is to run a second query/code to update Table3.description2 with data from Table2.description2 where the tracking numbers match.
I'd be glad to provide detailed help if this is a viable solution for you. [afro] jlitondo@gatecitysteel.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top