0

I've been struggling for a while now. Can someone help me?

I have 2 tables.

I have a table 'SKUS_info' with SKUS(a number assigned to a product), approximately about 30k rows.

And the second table 'truckparts_info' with all the data about products. It has 2 million rows. OE_NUMBER is identical to SKU from the first table. enter image description here

I want to fill the table SKUS_info with the data from the table truckparts_info

What I tried to do:

I wrote a script:

select v.sku, v.net_price t.TTC_TYP_ID, t.CAR_BRAND,t.CAR_MODEL, t.CAR_TYPE,
t.CAR_BODY, t.CAR_OF_YEAR, t.CAR_KW, t.CAR_PM, t.CAR_CC,
t.ART_NAME, t.ART_GROUP, t.PARTS_INFO, t.ART_CROSS 
from truckparts_info t inner join skus_info v on t.OE_NUMBER= v.SKU order by v.SKU

But it does exact opposite of what I need. The v.SKU and v.Net_price are being added to the table B and the query result shows 500k rows in the end.

Any ideas how to change the script the way I want?

EDIT:

The script output is: enter image description here

In this case you can see that SKU, Net_price are added to the table B

  • 1
    Please remove verbal table structure definitions and add output of SHOW CREATE TABLE tablename commands. Then show some example data (2-3 records) for there tables and desured result on that data. I want to fill the table SKUS_info with the data from the table truckparts_info You need UPDATE query, not SELECT one. – Akina Apr 25 at 9:54
  • Not sure I understand why you say that it does the opposite of what you need. Adding example data and outcome as @Akina asks will be helpful. Also please add a case where thuckparts_info has more than one row with the same OE_NUMBER value and clarify what you want to happen in that case. – redguy Apr 25 at 10:16
  • Added additional information. The thing is that the table B has a lot of information which is duplicated. – Sigitas Apr 25 at 10:47
  • Please check this as to why screenshots as opposed to text are not good! Also, please post any tables and data as DDL (CREATE TABLE blah (...);) and DML (INSERT INTO blah VALUES (...);). p.s. welcome to the forum! :-) – Vérace Apr 25 at 10:50
  • Please consider reading this advice – mustaccio Apr 25 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.