select pm.* from relation_master as rm left join product_master as pm on pm.product_id = rm.product_id where rm.type='subcat' and rm.type_id='123' and pm.product_status = 'publish' order by pm.product_push_to_top_date desc,product_id desc LIMIT 3040, 20