PB中数据窗口查询语句怎么加条件?

2024-11-11 19:53:35
推荐回答(2个)
回答1:

可以给数据窗口加变量, 但是如有空值, 查询语句应这样写
select gh,name,sum(je)
from person
where status = 't'
and (sex = :as_sex or sex is null)
group by gh,name

意思即是 查询 status = 't' 并且 sex = as_sex(指定要查询的变量) 或 sex 为空的记录

回答2:

select gh,name,sum(je) from person where status = 't' or sex in('m','f') group by gh,name