Guys,

I have 2 tables. My objective is to get the information from Table1 and place it to table2. the 2 tables have the same Itemnumber and DefectCode. How could make this in correct scripts cause when i make the script it triple the records.

TABLE1
ItemNumber---------Price---PO-------Code-Qty
P300-1710-DROID-U--302.05--9100962--506--1
P300-1710-DROID-U--302.05--9100962--553--4
P300-1710-DROID-U--302.05--9100962--505--2


TABLE2
Itemnumber---------ESN-----------------Code-COO
P300-1710-DROID-U--268435458109959871--506--MALAYSIA
P300-1710-DROID-U--268435458111803411--553--MALAYSIA
P300-1710-DROID-U--268435458115318904--553--MALAYSIA
P300-1710-DROID-U--268435458116412601--553--MALAYSIA
P300-1710-DROID-U--268435459401812963--553--MALAYSIA
P300-1710-DROID-U--268435458114918871--505--MALAYSIA
P300-1710-DROID-U--268435459402546544--505--MALAYSIA


RESULT
ItemNumber---------Price---PO-------Code-Qty--ESN-----------------COO
P300-1710-DROID-U--302.05--9100962--506--1----268435458109959871--MALAYSIA
P300-1710-DROID-U--302.05--9100962--553--4----26843545811180341--MALAYSIA
P300-1710-DROID-U--302.05--9100962--553--4----268435458115318904--MALAYSIA
P300-1710-DROID-U--302.05--9100962--553--4----268435458116412601--MALAYSIA
P300-1710-DROID-U--302.05--9100962--553--4----268435459401812963--MALAYSIA
P300-1710-DROID-U--302.05--9100962--505--2----2268435458114918871--MALAYSIA
P300-1710-DROID-U--302.05--9100962--505--2----2268435459402546544--MALAYSIA


Select t2.itemnumber, t2.esn, t2.coo, t1.price, t1.po
from table2 t2 left outer join table1 t1
on t2.itemnumber = t1.itemnumber
and t2.code = t1.code

Thank you in advance.

Regards,

Jov

Your second table seems to be an ITEM table that contains all of your items when the first Table is a new inventory table. I guess I would need to see the actual tables but it appears that table 2 contains the ESN and by federal law each mobile device has to contain and electronic serial number. So when you move P300-1710-DROID-U--302.05--9100962--553--4 it is going to place 4 records in the ITEM table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.