can we make multiple rows as comma seperated in SQL Query?
can we make multiple rows as comma seperated开发者_如何学JAVA in SQL Query?
query should return something like:
1, "john,mike,petra"
2, "bob,carl,sandra,peter,
etc
Do you want the all the columns to be comma separated and concatenated as a single string for each row? If yes, you can use this code.
select Name+','+Phone_NO+','+Address from <table_name>
Result will be looked like the following lines:
Bob,6589235,Anderson Street
Jake,8547868,Jefferson Street
If your column is not varchar type then you have to cast the columns.
This can easily be acomplished via Management Studio
精彩评论