DragonBorn DragonBorn - 1 year ago 87
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


year month result
2016 4 201604
2014 5 201405

Are there ways to do this?

Answer Source

If the column data types are integer, do

select year * 100 + month from tablename
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download