MySQL. How to write a query with subquery?

There is a table product, in this table 3 fields: maker (manufacturer), model (model of product) and type (product type).

I need to display a list of manufacturers that produce pc, but does not produce the laptop.

Here is the query I got:
SELECT DISTINCT maker FROM product
WHERE type LIKE "PC" AND type <> (
SELECT DISTINCT maker FROM product
WHERE type LIKE "Laptop%");

The error is:
ERROR 1242 (21000): Subquery returns more than 1 row
(Error 1242 (21000): Subquery returns more than 1 row)

Confusion is understandable, but how can I fix it?
July 9th 19 at 12:58
3 answers
July 9th 19 at 13:00
Solution
SELECT `p1`.`maker`
 FROM `product` AS `p1`
 LEFT `product` AS `p2` ON `p2`.`maker` = `p1`.`maker`
 AND `p1`.`type` LIKE 'PC%' AND `p2`.`type` LIKE 'Laptop%'
 WHERE `p2`.`maker` IS NULL
July 9th 19 at 13:02
Solution
SELECT DISTINCT(maker) FROM product WHERE type LIKE "PC" AND NOT LIKE "Laptop%"
Doesn't work like that. The query displays those manufacturers who produce the laptop s. - kaelyn52 commented on July 9th 19 at 13:05
oops misread the post.
SELECT DISTINCT maker FROM product
WHERE type LIKE "PC" AND maker NOT IN(
SELECT DISTINCT maker FROM product
WHERE type LIKE "Laptop%"); - bryana.Renn commented on July 9th 19 at 13:08
July 9th 19 at 13:04
Solution
SELECT DISTINCT maker FROM product
WHERE type LIKE "PC" AND maker NOT IN(
SELECT DISTINCT maker FROM product
WHERE type LIKE "Laptop%");

Find more questions by tags SQLMySQL