MySQL
- 1 ответ
- 0 вопросов
1
Вклад в тег
SELECT t.*
FROM твоятаблица t
INNER JOIN (
SELECT id
,(
CASE coalesce(field, '') WHEN '' THEN 0 ELSE 1 END +
CASE coalesce(field2, '') WHEN '' THEN 0 ELSE 1 END +
CASE coalesce(field3, '') WHEN '' THEN 0 ELSE 1 END +
CASE coalesce(field4, '') WHEN '' THEN 0 ELSE 1 END +
CASE coalesce(field5, '') WHEN '' THEN 0 ELSE 1 END +
CASE coalesce(field6, '') WHEN '' THEN 0 ELSE 1 END
) AS cnt
FROM твоятаблица
) AS a ON a.id = t.id AND a.cnt >= 2