rawdata Posted June 11, 2007 Share Posted June 11, 2007 Is there some way in MySQL to make one field of a record copy its value to another field of a different name as the record is created? Quote Link to comment https://forums.phpfreaks.com/topic/55043-is-there-a-way-to/ Share on other sites More sharing options...
AndyB Posted June 11, 2007 Share Posted June 11, 2007 Sure. Without seeing your insert statement this won't be exact but typically just use the same value for two fields Quote Link to comment https://forums.phpfreaks.com/topic/55043-is-there-a-way-to/#findComment-272106 Share on other sites More sharing options...
rawdata Posted June 11, 2007 Author Share Posted June 11, 2007 Actually, what I mean is can I make MySQL copy a field from another field? For instance, I have a table in my db with one field named ID that auto-increments. I need it to put the same value into another field within the same table named cb_cid. Is it possible to do this without writing a script to make it do this? Quote Link to comment https://forums.phpfreaks.com/topic/55043-is-there-a-way-to/#findComment-272149 Share on other sites More sharing options...
bubblegum.anarchy Posted June 11, 2007 Share Posted June 11, 2007 Triggers in MySQL version >= 5.0 : http://dev.mysql.com/doc/refman/5.0/en/triggers.html Triggers can insert a clone record. Quote Link to comment https://forums.phpfreaks.com/topic/55043-is-there-a-way-to/#findComment-272172 Share on other sites More sharing options...
AndyB Posted June 11, 2007 Share Posted June 11, 2007 Is it possible to do this without writing a script to make it do this? Can something happen without an instruction? Let's hope not. Quote Link to comment https://forums.phpfreaks.com/topic/55043-is-there-a-way-to/#findComment-272235 Share on other sites More sharing options...
rawdata Posted June 12, 2007 Author Share Posted June 12, 2007 I guess I did leave that wide open huh? I didn't mean to say that there would be no instruction to do so at all. Rather, that the instruction would be run from within MySQL, thru phpmyadmin perhaps, and not from an outside script. Sometimes though my coding seems to make things happen that I didn't tell it to do. I usually find out later that I did indeed tell it to do it, but at the time, I didn't think I did. Thanks for your replies. rd Quote Link to comment https://forums.phpfreaks.com/topic/55043-is-there-a-way-to/#findComment-272880 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.