这是我正在使用的表和数据:
表名:Customer_Table
Column 1<Product> Column 2<Region> Column 3<Customer Status>
EB1 AUSTRALIA CUSTOMER
PS2 NEW ZEALAND CUSTOMER
EB1 AUSTRALIA CUSTOMER
PS2 NEW ZEALAND DUPLICATE
PS2 NEW ZEALAND CUSTOMER
PS2 NEW ZEALAND CUSTOMER
EB1 AUSTRALIA
EB1 AUSTRALIA DUPLICATE
EB1 AUSTRALIA DUPLICATE
EB1 AUSTRALIA DUPLICATE
我在追求什么?
我正在尝试计算单个值
- 第1列= EB1
- AND COLUMN 2 =澳大利亚
- AND列3排除所有重复项但计算空值
醇>
最终结果应为= 3
答案 0 :(得分:1)
使用
SELECT COUNT(*)
FROM Customer_Table WHERE
Column3 NOT IN ( 'DUPLICATE' ) AND
Region = 'AUSTRALIA' AND
Product = 'EB1';