S
S
Sergey Pugovkin2020-06-24 16:51:33
MySQL
Sergey Pugovkin, 2020-06-24 16:51:33

How to find "missing" rows in MySQL?

There is a mysql table:

`id` = 1, `model` = 1, `language` = 1
`id` = 2, `model` = 1, `language` = 2
`id` = 3, `model` = 1, `language` = 3
`id` = 4, `model` = 2, `language` = 1
... The

maximum value of `language` is 34.
I need to find all `model` that do not have all `language` values. Those. those `model` for which there are not all 34 `language`.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Pugovkin, 2020-06-25
@Driver86

SELECT `model`, count(`language`) AS `c` FROM `table` GROUP BY `model` HAVING `c` < 34;

R
Rsa97, 2020-06-24
@Rsa97

GROUP BY, COUNT(), HAVING

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question