$str = '-Дом Автомобиль -Лебедь';
$str1 = preg_replace("/(\s|^)-[а-яёa-z]+/i", "", $str);
var_dump($str1);
$str2 = preg_replace("/(\s|^)-[А-ЯЁа-яёA-Za-z]+/", "", $str);
var_dump($str2);
select *,IF(field1 = '',0,1) + IF(field2 = '',0,1) + IF(field3 = '',0,1) + IF(field4 = '',0,1) + IF(field5 = '',0,1) + IF(field6 = '',0,1) AS myselector from my_table HAVING myselector >= 2;
select *,IF(not isnull(field1),1,0) + IF(not isnull(field2),1,0) + IF(not isnull(field3),1,0) + IF(not isnull(field4),1,0) + IF(not isnull(field5),1,0) + IF(not isnull(field6),1,0) AS myselector from my_table HAVING myselector >= 2;
SELECT id,(((SELECT price FROM table where value = table1.value1) + (SELECT price FROM table where value = table1.value2) + (SELECT price FROM table where value = table1.value3) + (SELECT price FROM table where value = table1.value4) + (SELECT price FROM table where value = table1.value5))/5) as avgprice FROM table1 ORDER BY avgprice;