Re: Making field concat of autoincrement column and other values?
| From: | Leif K-Brooks | Date: | Mon, 02 Dec 2002 03:39:19 +0000 |
| Subject: | Re: Making field concat of autoincrement column and other values? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23758@lists.php.net to get a copy of this message | ||
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:
-- 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.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 updatetherow 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...