如何从两个表中选择vales而不重复 [英] how can i select vales from two tables without repeating
本文介绍了如何从两个表中选择vales而不重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
表示我需要表1中的5个值和表2中的1个值用值东部应该只显示东部'< -
标记标记的粗体
安装访问控制45 10 450东部
安装cctv 50 502500 east
安装双重数据和语音25 1002500东部'< -
安装火警25 20 500东部'< -
供应接入控制150 10 1500东部
供应电缆40 3 120东部
供应火警40 20 800东部
供应cctv厄运类型120 50 6000东部
解决方案
如果从两个表中选择后返回类似的不同行,则只需在表上使用UNION
。
重复行将自动为删除。
例如
从TableA中选择A,B
UNION
选择A ,B来自表B
means i need 5 values from table 1 and 1 value from table 2 the bold values marked with the '<--
sign having eastern should only display eastern
installation of acess controls 45 10 450 eastern
installation of cctv 50 502500 eastern
installation of dual data and voice 25 1002500 eastern '<--
installation of fire alarms 25 20 500 eastern '<--
supply of acess controls 150 10 1500 eastern
supply of cables 40 3 120 eastern
supply of fire alarms 40 20 800 eastern
suppy of cctv doom type 120 50 6000 eastern
解决方案
If you are returning similar distinct rows after selecting from two tables just use aUNION
on the tables.
Duplicate rows will automatically be removed.
E.g.
select A, B from TableA UNION select A, B from TableB
这篇关于如何从两个表中选择vales而不重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文