DragonBorn DragonBorn - 7 months ago 8
SQL Question

How to combine two columns in sql

I have two column in sql

year month
2016 4
2014 5


What I want to do now is to combine these two columns together and get the period

Output

year month result
2016 4 201604
2014 5 201405


Are there ways to do this?

Answer

If the column data types are integer, do

select year * 100 + month from tablename