Results 1 to 2 of 2

Thread: inserts

  1. #1
    Join Date
    Nov 2003

    Unanswered: inserts

    Hi every1.
    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..
    pliz comment.
    Pleaseeeeeeeeeeeeeeeee Help

  2. #2
    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:

    PHP Code:
    update company c
    set c
    select industry_id 
     from orginal_csv o 
     where o
    .company_id c.company_id); 
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts