-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
  • 9,403
  • 5
  • 32
  • 45

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
  • 201,996
  • 37
  • 293
  • 362