|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Ok simple question im sure for most of you.
Lets say i have two tables in a DB named final and final1 final has 8 rows named a-h final1 has 2 rows named i-j I would like to change final where row C = final2 row I and replace that data with row J Make sence? any help? |
|
#2
|
|||
|
|||
|
will this be a trigger event?
so.... when ROW C (final) is equal to ROW I (final1) ... replace ROW C (final) with the value in ROW J is that correct? ![]() |
|
#3
|
|||
|
|||
|
yes, thats excatly what im trying to do
|
|
#4
|
|||
|
|||
|
what is it you're wanting to use the statement in?
Ive only done a bit of oracle forms trigger (plSQL) stuff.... but I know quite a bit about SQL statements.... |
|
#5
|
|||
|
|||
|
MySql using MyPhpAdmin
|
|
#6
|
|||
|
|||
|
right....I'll have a go.....
when ROW C (final) is equal to ROW I (final1) ... replace ROW C (final) with the value in ROW J well, firstly, you'd need to write some sort of if statement to trigger the SQL...... SELECT final.row_c, final1.row_i FROM final, final1 WHERE final.row_c = final1.row_i if that returns true... then you could call another statement... something like: UPDATE final SET row_c = (SELECT row_J from final); I'm just trying to think how to put it all together now........ errmmm...... you might be able to do an "EXISTS" operator.... UPDATE final SET row_c = (SELECT row_J from final) WHERE EXISTS (SELECT final.row_c, final1.row_i FROM final, final1 WHERE final.row_c = final1.row_i); so... the update comment will only update IF the second SQL statement returns a match... I hope. this might work, it might not....but it's a start! Let me know how it goes.... |
|
#7
|
|||
|
|||
|
Matt, Thanks for your help here,
Still getting errors, Maybe i Phrased that wrong by saying row C. The filed is "C" in final and Field "I" and "J" in final1 does that make a difference? If not, The first select statement threw an error at me. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Should be easy |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|