SELECT A.* , R.symbol, A.nazwaen as nazwa
FROM act_base_asortyment as A left join act_base_firmy as R on A.firma = R.id
WHERE (A.menu_id = '64' OR (A.mcat6 & 16)) AND (A.foto != '' AND R.xstatus = 2 AND A.nazwaen !='') AND A.status = 1 AND (A.perms & 1) AND A.date_end >= NOW() AND A.date_start <= NOW() AND A.lang & 4
ORDER BY rand()
LIMIT 32