FROM " . DB_PREFIX . "product_to_category ptc LEFT JOIN . DB_PREFIX . "category_description"
FROM oc_product_to_category ptcoc_category_description
LEFT JOIN oc_
?SELECT `ebids`.*, IFNULL(`c`.`qqq`, 0) AS `has_qqq_comment`,
IFNULL(`c`.`www`, 0) AS `has_www_comment`, IFNULL(`c`.`eee`, 0) AS `has_eee_comment`
FROM `ebids`
LEFT JOIN (
SELECT `item_id`, SUM(`itemtype` = 'qqq') AS 'qqq',
SUM(`itemtype` = 'www') AS 'www', SUM(`itemtype` = 'eee') AS 'eee'
FROM `comment_system`
GROUP BY `item_id`
) AS `c` ON `c`.`item_id` = `ebids`.`id`
WHERE `ebids`.`status` != 'auto'
ORDER BY `ebids`.`id` DESC
LIMIT 0, 100
SELECT `p`.*,
COUNT(`op`.`id`) AS `ordersCount`,
IFNULL(SUM(`op`.`count`), 0) AS `countOrdersCount`
IFNULL(SUM(`op`.`price` * `op`.`count`), 0) AS `ordersSum`
FROM `products` AS `p`
LEFT JOIN `orders_products` AS `op` ON `op`.`item_id` = `p`.`id`
LEFT JOIN `orders` AS `o` ON `o`.`id` = `op`.`order_id`
AND `o`.`date` > '2020-01-01'
AND `o`.`status` != 2
WHERE `p`.`active` = '1'
GROUP BY `p`.`id`
ORDER BY `p`.`id` DESC
LIMIT 0, 25
`year`
.