You can use the CONCAT
function like this:
SELECT CONCAT(`SUBJECT`, ' ', `YEAR`) FROM `table`
Update:
To get that result you can try this:
SET @rn := 0;
SELECT CONCAT(`SUBJECT`,'-',`YEAR`,'-',LPAD(@rn := @rn+1,3,'0'))
FROM `table`
More Related Contents:
- get first occurrence of last changed value of a column [closed]
- SQL Print the name of all Employees together with the name of their supervisor
- MySQL – Rows to Columns
- ROW_NUMBER() in MySQL
- multiple query same table but in different columns mysql
- How can I temporarily disable a foreign key constraint in MySQL?
- How to do a batch insert in MySQL
- MySQL offset infinite rows
- Ordering by the order of values in a SQL IN() clause
- Creating a “Numbers Table” in MySQL
- SQL Selecting from two Tables with inner join and limit [duplicate]
- MySQL Group by SUM
- Get the latest date from grouped MySQL data
- In SQL, how to select the top 2 rows for each group
- Mysql query to dynamically convert rows to columns on the basis of two columns
- MySQL Error 1264: out of range value for column
- How to change the default port of mysql from 3306 to 3360
- Special Characters in MySQL Table Name
- Is it possible to reference one column as multiple foreign keys?
- MySQL: How do I join same table multiple times?
- #1273 – Unknown collation: ‘utf8mb4_unicode_520_ci’
- How to set a MySQL row to READ-ONLY?
- Split a string and loop through values in MySQL stored procedure
- How to create dummy variable columns for thousands of categories in Google BigQuery?
- MySQL Select Query – Get only first 10 characters of a value
- Most efficient way to store IP Address in MySQL [duplicate]
- Getting first day of the week in MySql using Week No
- SQL date format convert? [dd.mm.yy to YYYY-MM-DD]
- mysql select id and name from other table and join query
- ORDER BY alphabet first then follow by number