Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 04-06-2006, 05:06 AM   #1
Registered: Sep 2004
Location: Hyderabad
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
Registered: May 2004
Location: Antwerp, Belgium
Distribution: slackware
Posts: 112

Rep: Reputation: 18
use a trigger

create trigger tr_update
after update of number on tabel1
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


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 > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:41 PM.

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