$(val).text( ( Math.round( $(val).text() - $(val).text() * percent * 0.01 ) ) || 'Ошибка');
SELECT `products_count`.`v`
FROM `products_to_tag` AS `p2t`
JOIN (
SELECT
`product_id`,
COUNT(*) as `v`
FROM `products` AS `p`
WHERE `p`.`publish` = 1
group by `products`.`id`
) as products_count
on `products_count`.`product_id` = `p2t`.`product_id`
JOIN `city` AS `c` ON `c`.`id` = `p`.`city_id`
Where
`p2c`.`tag_id` IN (917, 918, 919, 920, 921)
AND (`c`.`id` = 108 OR `c`.`parent_id` = 108)
SELECT COUNT(`p`.`id`)
FROM `products` AS `p`
LEFT JOIN `products_to_tag` AS `p2t` ON `p`.`id` = `p2t`.`product_id`
LEFT JOIN `city` AS `c` ON `c`.`id` = `p`.`city_id`
Where
`p`.`publish` = 1
AND `p2c`.`tag_id` IN (917, 918, 919, 920, 921)
AND (`c`.`id` = 108 OR `c`.`parent_id` = 108)
GROUP BY `p`.`id`
SELECT COUNT(`p`.`id`)
FROM `products` AS `p`
LEFT JOIN `products_to_tag` AS `p2t` ON `p`.`id` = `p2t`.`product_id`
LEFT JOIN `city` AS `c` ON `c`.`id` = `p`.`city_id`
Where
`p`.`publish` = 1
AND `p2c`.`tag_id` IN (917, 918, 919, 920, 921)
AND (`c`.`id` = 108 OR `c`.`parent_id` = 108)
if (tempScrollTop < currentScrollTop )
у вас будет false