MySQL Forums
Forum List  »  Newbie

Re: Identical input field value
Posted by: Felix Geerinckx
Date: August 16, 2005 04:06AM

M SELEEM wrote:

> I have a MySQL Database table, I would like to know how could I have one of my fields in my table
> to have the same inputs of 3 other fields in the same table with a dash "-" between then when
> submiting a new entry.

INSERT INTO yourtable (field1, field2, field3, combined_field) VALUES
('very', 'bad', 'idea', CONCAT('very', '-', 'bad', '-', 'idea');

But you should *not* do this, since you're duplicating data.
Calculated fields should be computed when you need them:

SELECT
CONCAT(field1, '-', field2, '-' field3) as combined_field
FROM yourtable

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
August 14, 2005 07:20AM
Re: Identical input field value
August 16, 2005 04:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.