Out of resources when opening file '/var/tmp/#sql_3079_4.MAD' (Errcode: 24) select id_banner, banner_text, banner_picture, banner_file, google_code , width, height, link_2 , level, shows, credit , banner_group from zzz_banner n where (id_departament='200' and n.is_desktop=1 and ( is_subpage=1 and ( ( shows>credit or credit=0 or credit is null ) and banner_text<>'' and banner_text is not null and ( ( ((n.show_date_from<=NOW() or n.show_date_from is null) and (n.show_date_to>=NOW() or n.show_date_to is null) and COALESCE(n.show_date_from,n.show_date_to) is not null ) or ((n.show_date_from_2<=NOW() or n.show_date_from_2 is null) and (n.show_date_to_2>=NOW() or n.show_date_to_2 is null) and COALESCE(n.show_date_from_2,n.show_date_to_2) is not null ) or ((n.show_date_from_3<=NOW() or n.show_date_from_3 is null) and (n.show_date_to_3>=NOW() or n.show_date_to_3 is null) and COALESCE(n.show_date_from_3,n.show_date_to_3) is not null ) or ((n.show_date_from_4<=NOW() or n.show_date_from_4 is null) and (n.show_date_to_4>=NOW() or n.show_date_to_4 is null) and COALESCE(n.show_date_from_4,n.show_date_to_4) is not null ) or COALESCE(n.show_date_from,n.show_date_to,n.show_date_from_2,n.show_date_to_2,n.show_date_from_3,n.show_date_to_3,n.show_date_from_4,n.show_date_to_4) is null ) ) and is_visible=1 ) ) or (token='' ) ) and n.id_banner_area='5708' and width<='1340' and id_banner not in (0) order by (token='' ) desc , COALESCE(`level`,0) desc , RAND() limit 1 |