从两个不同的表中选择输出 [英] select output from two various tables

查看:81
本文介绍了从两个不同的表中选择输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从table1 union中选择a,b,c从table2中选择a,b,c。

在sql中我使用UNION运算符从两个不同的表中选择输出。我需要第一个表解决方案的输出来自第二个表的那个。

i想要在table2之后得到结果table2

解决方案

你好,



无论我从你的问题中理解什么,你都可以尝试这个以获得所需的输出。



< pre lang =SQL> SELECT 1 ,....(第一个查询)
union
SELECT < span class =code-digit> 2 ,....(第二个查询)
订单 1





希望这对你有帮助。


select a,b,c from table1 union select a,b,c from table2.
in sql I am using the UNION operator to select output from two various tables. i need output from the 1st table solution to come before those from the second table.
i want get result to table1 after table2

解决方案

Hi,

Whatever i understand from your question, you can try this for getting required output.

SELECT 1,....(first table query)
union
SELECT 2,....(second table query)
Order by 1



Hope this will help you.


这篇关于从两个不同的表中选择输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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