I need to create a computed field in MySQL in which the contents of two fields are concatenated for another field and put into a record. I have a field called id which is the companies ID number and I also have another field called category which contains a code for the type of business which the company is. I then finally have a field called voucherid which will contain the results of the previous fields concatenated together. For example:
if the fields had the following values
id = 12
category = CZ
Then voucherid = CZ12
I found the following page on it: http://archives.neohapsis.com/archives/mysql/2004-q3/3000.html
but I couldn't get it to work.
Here is the query which I typed in:
ALTER TABLE business ADD COLUMN voucherid COMPUTED BY (category || id)
It failed - I got some syntax error.
Please could someone give me a query (or correct mine) which will accomplish what is (I'm sure) a relatively simple task?
Please help. Many thanks.