Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

using having with subqueries

NaamasMar 3 2022

Hi all,
I worte this query:
select c. CustomerID,COUNT(*) as total_orders
from Customers as c inner join orders as o
on c.CustomerID=o.CustomerID
group by c. CustomerID
having COUNT(*)> (select COUNT(*) as total_orders
from Customers as c inner join orders as o
on c.CustomerID=o.CustomerID
where c.CustomerID = 'alfki')
can i use subquery after having count ? or is it poor practice?
or is it always have to be
having count(*) >actual_number
thanks in advanced
Naama

This post has been answered by Frank Kulash on Mar 3 2022
Jump to Answer
Comments
Post Details
Added on Mar 3 2022
9 comments
1,664 views