mercredi 15 avril 2015

How to split a single column into multiple columns in sql-server select statement?

I am new to sql-server. I have a single long column with names starting from a, b, c and d. I want to show them in separate columns of NameA, NameB, NameC and NameD. I tried union but it shows in one column. I tried case but I dont know how to use it. Please help.





Select users where users.name like 'a%'
union
Select users where users.name like 'b%'



Aucun commentaire:

Enregistrer un commentaire