SQL Group with> 1
Perhaps the title was not the best one I could use to describe the problem. An example of the table structure I am dealing with is shown in the figure below. I need to write a query to pull all records for "Production" that have more than one record. So I would end up with LINUX UBUNTU 5.6 and LINUX REDHAT 7.8
Just returning duplicate PRODUCTION is easy and I can do it using a grouping having a count (*)> 1, but when it comes to returning duplicate production and matching columns, this is the problem I am facing.
source to share
returning duplicate PRODUCTION is easy and I can do it with grouping
having count(*) > 1
This is a good start. Now use this list manufacture
to select the rest of the data:
SELECT *
FROM software
WHERE manufacture IN (
-- This is your "HAVING COUNT(*) > 1" query inside.
-- It drives the selection of rows in the outer query.
SELECT manufacture
FROM software
GROUP BY manufacture
HAVING COUNT(*) > 1
)
source to share