There is a table of products with the fields id_product , title , visibility , id_parent . The field with a non-unique value is id_parent . The task is to get the number of unique id_parent values that satisfy the conditions. The construction below does not work; a clearly greater number of records are issued than the number of unique and satisfying conditions. I ask for advice in compiling the correct request.
$query = "SELECT count(`id_product`) FROM `products` WHERE `title` LIKE '%".$title."%' AND `visibility` = '' group by `id_parent` ";
select count(distinct id_parent) ...and no group by, if you need one value - Mike