LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 04: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, 05: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



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 03:17 PM
Need mysql query help DropHit Linux - Software 7 04-01-2005 11:32 AM
MySQL++ Query jimbob8483 Programming 1 12-15-2004 06:47 AM
MySQL Query Help Gerardoj Programming 1 06-10-2004 09:54 PM
Mysql Error: Lost Connection to Mysql during query ramnath Programming 5 11-18-2003 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:51 PM.

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
Open Source Consulting | Domain Registration