RE: [PHP-DB] Making field concat of autoincrement column and other values?
| From: | John W. Holmes | Date: | Mon, 02 Dec 2002 03:30:18 +0000 |
| Subject: | RE: [PHP-DB] Making field concat of autoincrement column and other values? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23757@lists.php.net to get a copy of this message | ||
> 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...