0

I would like to insert the pipe character | in a column to separate two sections of the output. Is there a way to put one in every row of a column as long as there is data in that row?

4

2 回答 2

0
select   column1, 
         column2,
         case 
           when column3 is not null 
           then '|' 
           else '' 
         end
from your_table
于 2012-05-11T07:24:13.670 回答
0

不是每列都起作用的。您将不得不为每一列重复它。

像这样的东西;

SELECT CASE col IS NULL THEN NULL ELSE CONCAT('|', col) END CASE FROM Table

于 2012-05-11T07:24:48.463 回答