select `category_ids` from `products` whereexists (select*from `brands` where `products`.`brand_id` = `brands`.`id` and (`status` =1)) and (`status` =1) and (`request_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 ('digital', 'physical') and (`added_by` ='admin')
select `id` from `products` whereexists (select*from `brands` where `products`.`brand_id` = `brands`.`id` and (`status` =1)) and (`status` =1) and (`request_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 ('digital', 'physical') and (`added_by` ='admin')
select `products`.*, (selectcount(*) from `reviews` where `products`.`id` = `reviews`.`product_id` and `status` =1) as `reviews_count`, (selectcount(*) from `order_details` where `products`.`id` = `order_details`.`product_id`) as `order_details_count`, (selectcount(*) from `reviews` where `products`.`id` = `reviews`.`product_id` and `status` =1) as `reviews_count`, (selectcount(*) from `wishlists` where `products`.`id` = `wishlists`.`product_id`) as `wish_list_count`, (selectavg(`reviews`.`rating`) from `reviews` where `products`.`id` = `reviews`.`product_id` and `status` =1) as `reviews_avg_rating` from `products` whereexists (select*from `brands` where `products`.`brand_id` = `brands`.`id` and (`status` =1)) and (`status` =1) and (`request_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 ('digital', 'physical') and (`added_by` ='admin') orderby `id` desc
select `categories`.*, (selectcount(*) from `products` where `categories`.`id` = `products`.`category_id` andexists (select*from `brands` where `products`.`brand_id` = `brands`.`id` and (`status` =1)) and (`status` =1) and (`request_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 ('digital', 'physical')) as `product_count` from `categories` where `position` =0
select `products`.*, (selectcount(*) from `order_details` where `products`.`id` = `order_details`.`product_id`) as `order_details_count` from `products` where `products`.`category_id` in (1, 2, 3, 4, 5, 6, 7, 8) andexists (select*from `brands` where `products`.`brand_id` = `brands`.`id` and (`status` =1)) and (`status` =1) and (`request_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 ('digital', 'physical')
select `categories`.*, (selectcount(*) from `products` where `categories`.`id` = `products`.`sub_category_id`) as `sub_category_product_count` from `categories` where `categories`.`parent_id` in (1, 2, 3, 4, 5, 6, 7, 8) and `position` =1orderby `priority` asc