NOT (street = 'Советская' AND house_number = '79')
AND NOT (street = 'Карбышева' AND house_number = '37')
AND NOT (street = 'Карбышева' AND house_number = '60')
...
(street != 'Советская' ОR house_number != '79')
AND (street != 'Карбышева' OR house_number != '37')
AND (street != 'Карбышева' OR house_number != '60')
...
(street != 'Советская' ОR house_number != '79')
AND (street != 'Карбышева' OR (house_number != '37' AND house_number != '60'))
...
SELECT * FROM (
SELECT `id`, 1 AS `fieldNum`, `apropid1` AS `apropid` FROM `table`
UNION SELECT `id`, 2 AS `fieldNum`, `apropid2` AS `apropid` FROM `table`
UNION SELECT `id`, 3 AS `fieldNum`, `apropid3` AS `apropid` FROM `table`
...
) AS `t`
WHERE `t`.`apropid` == 'something'
SELECT `d1`.`dialog_id`
FROM `dialog_users` AS `d1`
JOIN `dialog_users` AS `d2` ON `d2`.`dialog_id` =`d1`.`dialog_id`
JOIN (SELECT `dialog_id`, COUNT(*) AS `count`
FROM `dialog_users`
GROUP BY `dialog_id`)
AS `c` ON `c`.`dialog_id` = `d1`.`dialog_id`
WHERE `d1`.`user_id` = :user1
AND `d2`.`user_id` = :user2
AND `c`.`count` = 2