VBdotnet2005
asked on
return results in one string
My query returns a results like below.
select itemno from mytable where itemno between 9813 and 9865.
result :
9813
9814
9815
etc...
Can it be returned in one string with comma like below?
9813, 9814, 9815, etc
select itemno from mytable where itemno between 9813 and 9865.
result :
9813
9814
9815
etc...
Can it be returned in one string with comma like below?
9813, 9814, 9815, etc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@PortletPaul: beat you by exactly 14 seconds
@chaau, yes, so I see, too much fussing with the format at my end :)
I wish MSSQL had an easy to use GROUP_CONCAT() function like MySQL. :)
or LISTAGG() in Oracle
I agree with you. The syntax of stuff() plus "for xml path" is a bit tedious and a bit tricky.
(Hence my fixation with formatting it :)
I agree with you. The syntax of stuff() plus "for xml path" is a bit tedious and a bit tricky.
(Hence my fixation with formatting it :)
Concat_ws is better in my opinion. Works in Oracle and MySQL
I wish MSSQL had an easy to use GROUP_CONCAT() function like MySQL. :)
You have a couple of options:
1. Use CLR to build your own. It is not difficult and can be more flexible.
2. Be patient. :)
You have a couple of options:
1. Use CLR to build your own. It is not difficult and can be more flexible.
2. Be patient. :)