Take the 2-minute tour ×

I have 2 tables product_history having 3 columns

  1. id
  2. product_id
  3. admin_id

And another table(product_data) is to store data like..

  1. admin name
  2. product name
  3. product description
  4. product number .... etc.

Now I want to write a Mysql Trigger like. when record insert in product_history table I need to fetch all products and admin related information from product table and admin table and insert those records in product_data table.

How can I do this?

Basically I want to use select query with in Trigger body, but that select query can return multiple records. Is it possible?

share|improve this question
add comment

1 Answer

I think that you can retrive this information without need to insert data in another table, you can have: admin_id in your product_data table (and your admin_name, but would be redundat).

With your current idea, in your current product_data you should have a product_id field to related with your other table.

share|improve this answer
but I knowingly need to insert that records in product_data table. Its my requirement. –  Abhijeet Dange Dec 20 '13 at 4:18
add comment

Your Answer


