please help!!!

  • i would like to know if it is possible to get data from one table and take it to another table..

    for example

    CREATE TABLE Company (dpt_no int unsigned not null auto_increment primary key, dpt_name char(20) not null, salary money not  null)

    ****

    CREATE TABLE sales_dpt (s.no int unsigned not null auto_increment primary key, first_name char(20) not null, last_name char(20) not null, dpt_name char(20) not null, , salary money not null)

    ****

    i only want  the salary column from Company table to go to salary column in the sales_dpt table automatically!!!

     

    what would they trigger or stored procedure be?

     

    thanx in advance

     


    Kindest Regards,

    *4*

  • Can you be more specific on how they relate. I wouldn't think everyonw in the sales dept would have the same salary. I would think the company table would inherit the sum value for the sales dept as the total salary for the dept. Can you just explain the dynamics here first please? And I am thinking it will be a trigger.

  • thanx for your response!!!

    i have another table for the heads of the respective departments who have a unique salary!!

    the sales department table is only  for workers or employees in the department!!!

    I would like to get the Salary from the Company table and insert it into the Salary for the sales_dpt table automatically.

    Insert into Company (dpt_no int unsigned not null auto_increment primary key, dpt_name char(20) not null, salary money not  null)

    ****

    Insert into sales_dpt (s.no int unsigned not null auto_increment primary key, first_name char(20) not null, last_name char(20) not null, dpt_name char(20) not null, salary money not null)

    Can any help me with the trigger?

    <salary money not  null from Company = salary money not  null from sales_dpt>

     


    Kindest Regards,

    *4*

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply