このクエリをパーベイシブ データベースで実行しようとしています
select cust_no,cust_name,sum(bvtotal) as Amount
from sales_history_header
where cust_no is not null and number is not null and bvtotal > 1000 and in_date < 20140101
group by cust_no,cust_name
order by sum(bvtotal) desc;
サブ結果に in_date > 20140101 が含まれるグループ結果を除外するにはどうすればよいですか?
私が持っているこのクエリは、in_date > 20140101 の結果も取得しています。
私は何か間違っていますか?
私が得ているサンプル出力はこの形式です
cust_no cust_name amount
A a1 500
B b1 500
C c1 1000
cust_no 'A' のこのレコードを除外したいのは、20140202 の in_date で取引があったためです
生データで次のようなレコードがあることを考慮してください
cust_no cust_name amount in_date
A a1 100 20130203
A a1 400 20130101
A a1 1000 20140503