selectcount(*) as aggregate from `products` where ((`added_by` ='admin') andexists (select*from `brands` where `products`.`brand_id` = `brands`.`id` and (`status` =1)) and (`status` =1) and (`request_status` =1) or (`brand_id` isnulland `status` =1)) and (exists (select*from `sellers` where `products`.`user_id` = `sellers`.`id` and (`status` ='approved')) or ((`added_by` ='admin'and `status` =1))) and `product_type` in ('physical')
select `products`.*, (selectcount(*) from `reviews` where `products`.`id` = `reviews`.`product_id` and `delivery_man_id` isnulland `status` =1) as `reviews_count` from `products` where ((`added_by` ='admin') andexists (select*from `brands` where `products`.`brand_id` = `brands`.`id` and (`status` =1)) and (`status` =1) and (`request_status` =1) or (`brand_id` isnulland `status` =1)) and (exists (select*from `sellers` where `products`.`user_id` = `sellers`.`id` and (`status` ='approved')) or ((`added_by` ='admin'and `status` =1))) and `product_type` in ('physical') orderby `created_at` desc limit 20offset100
select `brands`.*, (selectcount(*) from `products` where `brands`.`id` = `products`.`brand_id` and ((`added_by` ='admin') andexists (select*from `brands` where `products`.`brand_id` = `brands`.`id` and (`status` =1)) and (`status` =1) and (`request_status` =1) or (`brand_id` isnulland `status` =1)) and (exists (select*from `sellers` where `products`.`user_id` = `sellers`.`id` and (`status` ='approved')) or ((`added_by` ='admin'and `status` =1))) and `product_type` in ('physical')) as `brand_products_count` from `brands` where `status` =1orderby `created_at` desc
select `brands`.*, (selectcount(*) from `products` where `brands`.`id` = `products`.`brand_id` and ((`added_by` ='admin') andexists (select*from `brands` where `products`.`brand_id` = `brands`.`id` and (`status` =1)) and (`status` =1) and (`request_status` =1) or (`brand_id` isnulland `status` =1)) and (exists (select*from `sellers` where `products`.`user_id` = `sellers`.`id` and (`status` ='approved')) or ((`added_by` ='admin'and `status` =1))) and `product_type` in ('physical')) as `brand_products_count` from `brands` where `status` =1orderby `created_at` desc
selectcount(*) as aggregate from `products` where ((`added_by` ='admin') andexists (select*from `brands` where `products`.`brand_id` = `brands`.`id` and (`status` =1)) and (`status` =1) and (`request_status` =1) or (`brand_id` isnulland `status` =1)) and (exists (select*from `sellers` where `products`.`user_id` = `sellers`.`id` and (`status` ='approved')) or ((`added_by` ='admin'and `status` =1))) and `product_type` in ('physical') and `discount` !=0