MySQL Forums
Forum List  »  Triggers

Creating Trigger Using two Tables
Posted by: Jitesh A
Date: May 29, 2012 01:03AM

I have two table having the column name as -
Service, Numbers, Prefer, Ops, Phone
in both the tables.
Table1 is my main table and table2 is my temporary table. I wanted to perform add and delete operation for table1 from taking the values of table2.
In table2 there is a column by name Ops which Contains 2 Alphabets 'A' and 'D'.
'A' states to add and 'D' states to delete. Deletions of records would happen by comparing the values of table2 where ops=D and numbers='somevalue'. And addition of records would be Ops=A.


This is my main table1
Service Numbers Prefer Ops Phone
1 9032386097 0 A 2
1 9032394808 0 A 2
1 9032404942 0 A 2
1 9032460716 0 A 2
1 9032499004 0 A 2
1 9032499792 0 A 2
1 9032558059 0 A 2
1 9032660138 0 A 2
1 9032813579 0 A 2
6 9033019137 0 A 2
6 9033033245 0 A 2
6 9033034368 0 A 2
6 9033116875 0 A 2
6 9033136727 0 A 2
6 9033206822 0 A 2
6 9033208315 0 A 2
6 9033215658 0 A 2
6 9033237464 0 A 2
6 9033237813 0 A 2


And my table2 values are

Service Numbers Prefer Ops Phone
1 9032386097 0 D 2
1 9032394808 0 D 2
1 9032404942 0 D 2
1 9032460716 0 D 2
1 9032499004 0 D 2
1 9032499792 0 D 2
1 9032558059 0 D 2
1 9032660138 0 D 2
1 9032813579 0 D 2
6 9033019137 0 D 2
6 9033033245 0 D 2
6 9033034368 0 D 2
6 9033116875 0 D 2
6 9033136727 0 D 2
6 9033206822 0 D 2
6 9033208315 0 D 2
6 9033215658 0 D 2
6 9033237464 0 D 2
6 9033237813 0 D 2
6 9033365313 0 A 2
6 9033365574 0 A 2
6 9033369490 0 A 2
6 9033376618 0 A 2
6 9033378227 0 A 2
20 9952150169 0 A 2
14 9970109189 0 A 2
20 9600752426 0 A 2
20 9600754180 0 A 2
14 9730338185 0 A 2
21 9935065993 0 A 2
20 9952230466 0 A 2
20 9952243714 0 A 2
14 8600934625 0 A 2
20 9944420104 6 A 2
20 8220108573 0 A 2
19 8890460161 0 A 2
20 9003353109 0 A 2
14 9730259052 0 A 2
20 9566655870 0 A 2
18 9815443588 0 A 2
20 9597828908 0 A 2
14 8600911952 0 A 2
14 9665163795 0 A 2
19 8290405048 0 A 2
14 9960100145 0 A 2
20 9677386495 0 A 2
20 9677386057 0 A 2
20 8754243340 0 A 2
12 9163618066 0 A 2
20 9791884063 0 A 2
20 8754229154 0 A 2
20 8754981004 0 A 2
20 9500312700 0 A 2
20 8056706367 0 A 2
23 9679796176 0 A 2
14 7709643320 0 A 2
20 9600794571 0 A 2
20 9600794487 0 A 2
20 9894612914 0 A 2
20 8754975355 0 A 2
20 9789346233 0 A 2
20 8056692388 0 A 2
18 8146691300 0 A 2
1 8978270235 0 A 2
20 9597894970 0 A 2
20 9629501290 0 A 2
20 9894030102 0 A 2
20 9629601257 0 A 2


I want to add and delete records where there is A and D respectively.

Options: ReplyQuote


Subject
Views
Written By
Posted
Creating Trigger Using two Tables
3176
May 29, 2012 01:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.