select `brands`.*, `images`.`url` as `url`, `images`.`file` as `file`, `images_mobile`.`url` as `url_mobile`, `images_mobile`.`file` as `file_mobile` from `brands` innerjoin `images` on `brands`.`id` = `images`.`related_id` innerjoin `images` as `images_mobile` on `brands`.`id` = `images_mobile`.`related_id` where `images`.`type` ='brands'and `images`.`main` ='1'and `images_mobile`.`type` ='brands-mobile'and `images_mobile`.`main` ='1'and `brands`.`deleted_at` isnulland `brands`.`is_active` ='1'orderby `sort` asc