-1

I have a table that includes 3 columns:

enter image description here

How can i get the makers who produce only one product type and more than one model? The answer should output the maker and the type.

Thank you!

Bentaye
  • 8,857
  • 4
  • 30
  • 41

1 Answers1

1
select maker, type
from your_table
where maker in
(    
    select maker
    from your_table
    group by maker
    having count(distinct type) = 1
       and count(distinct model) > 1
)

The inner select gets the makers and the outer select adds the type.

juergen d
  • 195,137
  • 36
  • 275
  • 343