如何使用条件语句过滤 impala 查询中 where 子句中的记录
how to filter a record in where clause in impala query using conditional statements
以下为示例数据供参考
table 1
col1 col2
cmpy1 dev
cmpy1 testing
cmpy1 support
cmpy2 dev
cmpy2 testing
cmpy2 support
cmpy3 dev
cmpy3 testing
cmpy3 support
我将在 impala 中的 table1
之上创建一个视图 table1_view
,该视图应该像 col1 = 'cmpy1'
和 col2
时一样过滤掉记录在 'dev' 中,所以当我 select * from table1_view
.
时,其余记录应该会显示在视图中
有人可以帮我在 where
子句中应用过滤条件吗?
I will create a view table1_view
on top of table1
in impala, the view should filter out the record like when col1 = 'cmpy1'
and col2
in 'dev'
您只想要一个 where
子句吗?
create view table1_view as
select col1, col2
from table1
where not (col1 = 'cmpy1' and col2 = 'dev')
以下为示例数据供参考
table 1
col1 col2
cmpy1 dev
cmpy1 testing
cmpy1 support
cmpy2 dev
cmpy2 testing
cmpy2 support
cmpy3 dev
cmpy3 testing
cmpy3 support
我将在 impala 中的 table1
之上创建一个视图 table1_view
,该视图应该像 col1 = 'cmpy1'
和 col2
时一样过滤掉记录在 'dev' 中,所以当我 select * from table1_view
.
有人可以帮我在 where
子句中应用过滤条件吗?
I will create a view
table1_view
on top oftable1
in impala, the view should filter out the record like whencol1 = 'cmpy1'
andcol2
in 'dev'
您只想要一个 where
子句吗?
create view table1_view as
select col1, col2
from table1
where not (col1 = 'cmpy1' and col2 = 'dev')