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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add distinct fields from one table into another

Status
Not open for further replies.

HomerJS

Programmer
Jun 25, 2001
86
0
0
US
I have two tables. Tbl1 starts by having only OrderNo for data. Tbl2 has multiple occurences of the same order and owner. I want to add each owner into tbl1. An example is below.

tbl1
OrderNo Owner1 Tractor Owner2
123
456

tbl2
OrderNo Owner Tractor
123 9 7
123 9 7
456 11 12
123 8 6

RESULT WANTED:
tbl1
OrderNo Owner1 Tractor Owner2
123 9 7 8
456 11 12 <null>
 
Are you sure you want to do that? You will go from having accurate data to having inaccurate data.

For OrderNO 123 you currently show two owners (9 and 8) and two tractors (7 and 6).

In the results you want, you show that there are two owners (9 and 8) but only one tractor (7). Tractor 6 is no longer going to be in the database and there will be two owners for tractor 7.

Is that really what you want to do?

-SQLBill

 
Yeah I realized that and although as you pointed out it would be less acurate, it is what I want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top