Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

How to use Group by and Having in a SQL query in NiFi ?

avatar
Contributor

Hi All,

 

I have been trying to using group by with having clause in the ExecuteSQL processor but it doesn't seem to be returning the count.

 

The SQL query looks like :

 

select id_num, count(*) from xyz 

where id_num<>0

group by id_num

having count(*)>1

 

I put this in the SQL select query. I just get an empty array. How do I use group by and having in the select query in Nifi? A normal query without these clauses works perfectly but I need a count to check for duplicates in the database.

 

Thank you in Advance

1 ACCEPTED SOLUTION

avatar
Contributor

I just realised that NiFi only supports "Group by" and doesn't support "HAVING" clause. I had to put the queries in a python script and call an execute stream command processor.

 

View solution in original post

1 REPLY 1

avatar
Contributor

I just realised that NiFi only supports "Group by" and doesn't support "HAVING" clause. I had to put the queries in a python script and call an execute stream command processor.