I have below table with 3 columns in sql server.I want to compare [yearmonth] with a concatenation of [year] and [month] columns. like... select count(*) from table where [yearmonth]=concat([year],[month]).
Catch is here that whenever we have a [month] value of single-digit we have to add 0 as a prefix in it. like for the first record, it should become 05 instead of 5 while comparing.so final count of select count(*) from table where [yearmonth]=concat([year],[month]) should be 3
Data type of [yearmonth] is nvarchar
Data type of [year] is nvarchar
Data type of[month] is int