Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hive 比较两个列相同但数据值不同的配置单元表_Hive - Fatal编程技术网

Hive 比较两个列相同但数据值不同的配置单元表

Hive 比较两个列相同但数据值不同的配置单元表,hive,Hive,一个数据库有两个表table1和table2。这两个表的结构相同 表1 姓名得分1分2分决赛 a 0 1 0 表2 姓名得分1分2分决赛 a 0 0 0 我想比较两个表,检查表2.score的值是否等于表1.score+2 我想让配置单元查询检查一下 enter code here select count(*) from test.table2 a, test.table1 b where a.score1='2' and a.score2='0' and b.score1='2' and

一个数据库有两个表table1和table2。这两个表的结构相同

表1 姓名得分1分2分决赛 a 0 1 0

表2 姓名得分1分2分决赛 a 0 0 0

我想比较两个表,检查表2.score的值是否等于表1.score+2 我想让配置单元查询检查一下

enter code here

select count(*)
from test.table2 a,
test.table1 b
where a.score1='2' and a.score2='0' 
and b.score1='2' and b.score2='0' 
and a.scorefinal=(b.scorefinal+2);
我想以更好的方式使用连接进行比较,如果可能的话

select*from

选择*, a.score1=b.score1或a.score2=b.score2或a.scorefinal=b.scorefinal+2时的情况 那么1 其他0 结束为值-在此处给出一个OR条件,这意味着如果其中任何一个为真,则为1,如果您需要在所有需要保留的情况下该条件为真,则为1

从 表2 a, 表1 b

q
其中value=1

到目前为止您做了什么?