Skip to content
Advertisement

How to concatenate two different values from two different columns with comma ” , ” using TSQL?

I would like to know how to concatenate two different values from two different columns from a SQL table using TSQL ?

enter image description here

As you can see, I would like to concatenate those two different columns X e Y, resulting in the follow column table:

enter image description here

Which query should be used here ?

Advertisement

Answer

You can use concat as

SELECT 
    Source, QtyPrevious, QtyToday, ProductPrevious, ProductToday, 
    AvaDatePr, AvaDateToday, Clusters, CONCAT(X, '', Y) as Z 
from your_table_name;
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement