我想将varchar值与空值组合
FOR EG:
SELECT COL1
FROM(
SELECT 'ABC' AS COL1
UNION
SELECT '' AS COL1) T
这给了我两个结果' abc'和' null' 但我想添加' abc'与' null'仅获得一个结果即:' abc' 就像我们在主查询中使用sum运算符一样使用数字
SELECT SUM(COL1)
FROM
(
SELECT 1 AS COL1
UNION
SELECT '' AS COL1
) P
结果将是' 1'
如何使用varchar值
答案 0 :(得分:0)
提供WHERE
条件
SELECT COL1
FROM
(
SELECT 'ABC' AS COL1
UNION
SELECT '' AS COL1
) T
WHERE COL1 IS NOT NULL AND COL1 <> ''