Skip to content
Advertisement

How to return results from a subquery greater than a value

I’m trying to find measuring component ids that show up at least 3 times. At this time it is throwing the Oracle Error “ORA-00936: missing expression.” I have tried putting in an existing statement to possibly satisfy the missing expression error, to no avail. It either returned too many values or didn’t bring back any values at all. How do I fix it to bring back results where my measuring component column brings back values that occur at least 3 times.

Advertisement

Answer

My original query works using the group by and having function once you add in the expression exists. What needed to be done to have the subquery actually work though was to correlate it to the main query. This was done by adding in the date parameter found in the main query, the parameter looking for “discarded and removed” and also by creating an inner join in the sub query itself, which joined the table used in the sub query to the table in the main query. The final result looked like this:

I appreciate everyone’s help in getting this result.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement