开发者

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:

  1. Bob,6589235,Anderson Street

  2. 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

can we make multiple rows as comma seperated in SQL Query?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜