12-10-03, 11:43 #1Registered User
- Join Date
- Nov 2003
I got a quick question...
i have 2 tables industry and company
my industry table has 32 rows and has industry_id as pk
company table has company_id as pk and industry_id as a FK and has 1300 rows.
both the tables are loaded except that the industry_id column in the company table is blank. I need to insert that just 1 row but the problem is that i dont wanna do each row separately and manually,cuz each industy has about 20 companies. hope u guys know what i mean... pliz tell me if theres an easier way to do this. I have the csv files for both tables so i dont mind truncating the tables and load them again if that makes my job any easier..
12-10-03, 12:53 #2Registered User
- Join Date
- Jul 2003
Please post the original file.
It's somewhat difficult to give you a decent solution without looking at the file.
Without the file, you have no way to map the industries to the company.
One way would be to load the original file as-is, then write a simple update script:
update company c
set c.industry_id =
from orginal_csv o
where o.company_id = c.company_id);
you can lead someone to something but they will never learn anything ...