John W. Holmes wrote:
I'm trying to make a field in my database table a concat of anthe
autoincrement value and some other values. I'm trying:
insert into table set
val1='val1',val2='val2',concatfield=concat('whatever',id,'whatever'),
but it doesn't work. Is there another way, or will I have to update
row directly after inserting?You'll have to do it after. Id probably doesn't even have a value since
you're just creating the row.
But, why do it this way? Why not add two more columns where you put in
'whatever' and 'whatever', then do the CONCAT when you actually SELECT
out the data. Then nothing is repeated. With your method, what if the ID
ever changes, then you'll have two columns to update.
---John Holmes...
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.