Re: Making field concat of autoincrement column and othervalues?

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

 



I could concat when selecting, but it will be used in the where clause (it is neccesary to do it like this, I'm also md5ing it but forgot to mention that), and I'm guessing it would be bad for the server to have to concat and md5 in the where clause.

John W. Holmes wrote:

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...




--
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.



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

  Powered by Linux