Wednesday, March 28, 2012

Putting commas between select statement values

Hello,

This may be a strange request, but I am going to ask about it anyways.

Say for example if I have a table named TEST and in the table there is a column named NUMBERS, such that it is like this:

NUMBERS
1
2
3
4

How could I use a select statement in a way that a comma would seperate every return value, such that if I go 'Select NUMBERS from TEST' I would get:

1,2,3,4

Instead of:

1
2
3
4

Any ideas?

ThanksThe numbers will still be as o column... but try:

SELECT CAST(numbers as varchar)+',' from TEST

No comments:

Post a Comment