Translating SQL having clause in Solr query

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Translating SQL having clause in Solr query

Hi Guys,

I am new to the Solr world and I am using Solr 5.4.1. I have a question and hope to find answer to the same.

Consider a SQL query as:

select A, sum(B), sum(C)
from Col1
where D = ‘Test’
group by A
having sum(B) > 20
order by A
limit 100

I am able to translate the above to Solr Query partially using pivot facet. But how do I have the having clause implemented in my Solr Query. Without having clause in place the number of records is too large and so the pivoting on A is returning a very large result. In addition the number of distinct value for A is also very high.

Please advice me how to solve this problem.

P.S. It is not possible for me to use Solr SQL of Solr 6 which allows above SQL to execute.

Sagar Palao