我正在运行以下SQL查询:
select distinct col + "abc" value1, col+ "xyz" value2
from table_name
where col = "1234567890"
这将输出返回为:
value1 value2
1234567890abc 1234567890xyz
但是我希望输出为:
value
1234567890abc
1234567890xyz
我该怎么做?
答案 0 :(得分:1)
使用union all
select distinct col + "abc" value
from table_name
where col = "1234567890"
union all
select distinct col+ "xyz"
from table_name
where col = "1234567890"
答案 1 :(得分:0)
使用concat并全部合并
select concat(col, 'abc') value1
from table_name
where col = '1234567890'
union all
select concat(col, 'xyz')
from table_name
where col = '1234567890'