Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
751 views
in Technique[技术] by (71.8m points)

sql - Apply condition within a group in Nifi

How to get list of suppliers having only open orders? My sample data is as below:

SuppierID, orderID, orderStatus,orderdate
1,11,open,12/28/2020
1,22,open,12/27/2020
2,33,open,12/26/2020
2,44,closed,12/27/2020
3,55,closed,12/26/2020

Expected output is:

1,12/28/2020

Tried with groupby and having in query record processor but having clause not supported by Nifi it seems


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You could try something like

SELECT DISTINCT T.SupplierID FROM YourTable AS T WHERE NOT EXISTS ( SELECT 1 FROM YourTable AS X WHERE T.SupplierID=X.SupplierID AND X.orderStatus='closed' )


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...