I have a table with three columns: myColumn, myColumn2 and myColumn3. Three columns may have a different meaning, but they are all the same.
I need to make the connection so that I combine all the elements in three columns and then group by
If I had one column, this would be done as follows:
select distinct (myColumn), COUNT(myColumn) as 'TotalF' from FormularioCorto where idEvento = @idEvento and myColumn <> '' group by myColumn
Question: How do I make a TSQL statement that allows me to join three columns and then group by?
Edit: here is sample data I have a table that has 3 columns with the same type
columna columnb columnc aab bab ccd
I need to run tsql, which will combine 3 columns and a group to get the result, e.g.
newcolumn count a 3 b 3 c 2 d 1
Any ideas?
Thank you in advance
source share