select p.id as value, p.p_name as text,case when p_shortDesc = '' then ' ' else p_shortdesc end as q, p_comment from Pictures p inner join PictureTypes pt on p.pt_id = pt.pt_id where house_id = 3423 and Ap_ID = 0 and pt_alias = 'big' and p_deleted = 0 order by first_Pic desc, p_sort,ID desc