LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 04-06-2006, 05:06 AM   #1
sailu_mvn
Member
 
Registered: Sep 2004
Location: Hyderabad
Distribution: FEDORA,REDHAT,HOST
Posts: 440
Blog Entries: 1

Rep: Reputation: 30
Question mysql query


I have two tables. Both the tables contain a same field called 'number'. When that field is updated in table1, the same field in table2 should also get auomatically updated.
Can anyone suggest me how to go about with this query?
 
Old 04-06-2006, 06:27 AM   #2
thermite_1033
Member
 
Registered: May 2004
Location: Antwerp, Belgium
Distribution: slackware
Posts: 112

Rep: Reputation: 18
use a trigger

Code:
create trigger tr_update
after update of number on tabel1
begin
update table2
set number=:new.number
where number=:old.number

end tr_update
this syntax is used in oracle maybe you need to change something=> look it up in the mysql manual for the wright syntax

i never tried a trigger in mysql yet, maybe tomorow i'll go have fun with using triggers
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mySQL query help ezra143 Programming 3 04-25-2005 04:17 PM
Need mysql query help DropHit Linux - Software 7 04-01-2005 12:32 PM
MySQL++ Query jimbob8483 Programming 1 12-15-2004 07:47 AM
MySQL Query Help Gerardoj Programming 1 06-10-2004 10:54 PM
Mysql Error: Lost Connection to Mysql during query ramnath Programming 5 11-18-2003 01:27 PM


All times are GMT -5. The time now is 06:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration