可以合并和合并线吗? [英] Can union and combined line ?

查看:109
本文介绍了可以合并和合并线吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有个例子:

I have example:

SELECT 1 AS ID, 'a' AS NAME1, null AS NAME2
UNION
SELECT 1 AS ID, 'a' AS NAME1, 'b' AS NAME2


结果:

ID NAME1 NAME2
1个为空
1 a b

如何结合?

ID NAME1 NAME2
1 a b


Result:

ID NAME1 NAME2
1 a null
1 a b

How can it combined ?

ID NAME1 NAME2
1 a b

推荐答案

您不能.您进行了一个联合,要求输入null值,所以有了它.我不知道合并"是什么意思,但是在两种情况下您都选择了与NAME1相同的内容,因此没有什么可以合并的.您可以得到所要的东西,并且根据您的问题,除了删除工会以外,您什么都不需要.
you can''t. You did a union asking for the null value, so you have it. I don''t know what you mean by ''combined'', but you are selecting the same thing as NAME1 in both cases, so there''s nothing to combine. You''re getting exactly what you asked for, and based on your question, there''s nothing else you could want, apart from removing the union


这篇关于可以合并和合并线吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆