Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Computed fields in MySQL

ITAITA Member Posts: 463
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:

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.

Sign In or Register to comment.