RE: Making field concat of autoincrement column and other values?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I'm trying to make a field in my database table a concat of an
> 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
the
> 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...



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux