select `item_master`.*, (SELECTSUM(quantity) FROM supplier_items WHERE supplier_items.item = item_master.id) as quantity, (select manufacturer_master.image from `manufacturer_master` where `manufacturer_master`.`id` = item_master.mfr and `item_master`.`mfr` isnotnullorderby `created_at` desc limit 1) as mfr_image, (select manufacturer_master.name from `manufacturer_master` where `manufacturer_master`.`id` = item_master.mfr and `item_master`.`mfr` isnotnullorderby `created_at` desc limit 1) as mfr_name, (select item_category_master.name from `item_category_master` where `item_category_master`.`id` = item_master.item_category orderby `created_at` desc limit 1) as item_category_name from `item_master` where `item_master`.`active` =1and `item_master`.`mfr` isnotnulland `quantity` >0orderby `id` desc limit 50offset21450