Andy, March 19, 2003 - 3:19 am UTC
Wow - Analytics do indeed rock, don't they!! Thanks for your helpful and quick answer.
Varition on this theme
Andy, June 17, 2003 - 7:56 am UTC
Tom, as a variation on this theme, how would I show column values (for, say, a set of address elements) in such a way as to "squeeze" out blank entries, so that non-empty entries are "shunted" to the left to accomodate empty entries.
e.g. I'm trying to select address elements from a table in such a way as to avoid "gaps". For instance, say my address elements (for a given row) are:
addr1 addr2 addr3 city country
----- ----- ----- ---- -------
A B NULL C D
in some cases, not all of the "addr" parts are needed (col. addr3 in this case), so I want to squeeze out the blanks, and return it all as one row like this:
element1 element2 element3 element4
-------- -------- -------- --------
A B C D
What's the best way to do this in one SQL statement?
Many thanks for your great site.
Andy
June 17, 2003 - 12:26 pm UTC
I don't see an "easy" way -- the problem is that the column you want next is dependent on previous columns and -- yuck. It gets "hard"
I guess I would use concatenation and return a SINGLE address field ( a string )
Multiple rows in a single column
Jean-Pierre, June 20, 2003 - 10:24 am UTC
Hi
I have a table with 1 column and n rows (I don(t know the number of rows -- where COL1 like '%...%' --) :
COL1
----
0001
0002
0155
0457
7988
....
....
I'd like to write a query which produce this :
COL1
----------------------------------------------
0001,0002,0155,0457,7988,......
Is there any way to obtain this ?
Thanks
June 20, 2003 - 5:29 pm UTC