Sample data
yearmon
Jul-2017
Aug-2017
Sep-2017
Jan-2018
Jul-2018
I want to add '15' for yearmon column .
I have tried using concat function but it doesnt work.
Expected
yearmon
15-Jul-2017
15-Aug-2017
15-Sep-2017
15-Jan-2018
15-Jul-2018
The SQL Standard has an operator for concatenation, which is easy to understand and quick to type. You just use the || operator, just like you'd use a + for integers:
SELECT '15-' || yearmon AS full_date FROM table;
concat function is calling || operator internally. concat function will be called as following.
SELECT concat ('15-', yearmon) AS full_date FROM table;
SELECT concat_ws ('-', '15', yearmon) AS full_date FROM table;