Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Karachi, Pakistan

    Unanswered: Insert into multiple table


    I need to make insert statement in multiple tables with using one sql statement.

    insert into statistics_Region(Region,salary)
    Select Region,sum(salary)
    from Transaction
    group by

    above statement insert rows in statistics_Region table, what I required is,insert records in statistics_location table which have a location wise statistics summary (subset of region).

    Is it possible that through above select statment I insert into both tables once.

    Actually it take very long time to run and I don't have a time to execute one more statment for inserting data in location table seperately.

    If any way to do this. kindly help me. hopefully my problem is understandable for all.

    Noor Ali

  2. #2
    Join Date
    Mar 2002
    Reading, UK
    Look up insert all in the sql manual.


  3. #3
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    IMO, this "requirement" to duplicate data is flawed & violates 3rd Normal Form.
    If you REALLY insist on duplicating data, you could always create a trigger on the 1st table which then populates the 2nd table.
    What mechanism exists to ensure that all duplicated data stay in synch between tables where it resides?
    Last edited by anacedent; 07-08-07 at 13:30.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

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