select max(products.id) id, sectionId
            from products
            inner join product_images on product_images.product_id = products.id
            where sectionId in () and brandId = ? and products.isLive = 1 and products.genderId = 2
            group by sectionId
            order by id desc
            limit 0,0
Array
(
    [0] => 42000
    [1] => 1064
    [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and brandId = '5' and products.isLive = 1 and products.genderId = 2
          ' at line 4
)