Back
There are two columns in a MySQL table: SUBJECT and YEAR.
I want to generate an alphanumeric unique number which holds the concatenated data from SUBJECT and YEAR.
How can I do this? Is it possible to use a simple operator like +?
You can use the following SQL query to concatenate SUBJECT and YEAR columns in a table:
SELECT CONCAT ('SUBJECT', ' ', 'YEAR') as new_column from Table_Name
The second argument is to create space between SUBJECT and YEAR columns after concatenating.
I recommend going through this SQL tutorial to learn more about CONCAT() function.
31k questions
32.8k answers
501 comments
693 users