Database error: Invalid SQL: select * from (
select a.artkey, 0 as epub, a.urlname, a.actdate, n.outdate as pubdate,
cast(cn.ctx as char(666) character set latin2) collate latin2_general_ci as aname,
cast(ca.ctx as char(666) character set latin2) collate latin2_general_ci as authors,
cast(cc.ctx as char(3333) character set latin2) collate latin2_general_ci as comment,
cast(ck.ctx as char(3333) character set latin2) collate latin2_general_ci as keywords
, a.doi, a.doiblok, d.crstatus
from articles a join magnos n using (mag, vol, no) left join dois d on (a.artkey = d.artkey)
left join ctx cn on (a.artkey = cn.artkey and cn.type = 2 and cn.paraid = 0)
left join ctx ca on (a.artkey = ca.artkey and ca.type = 1 and ca.paraid = 0)
left join ctx cc on (a.artkey = cc.artkey and cc.type = 4 and cc.paraid = 0)
left join ctx ck on (a.artkey = ck.artkey and ck.type = 3 and ck.paraid=0)
where a.mag='www' and a.vol= and a.no=0
UNION
select ra.tartkey as artkey, 1 as epub, null as urlname, ra.finalsaved as actdate, ra.finalsaved as pubdate,
cast(ifnull(cn.ctx collate latin2_general_ci, ra.namecz collate latin2_general_ci) as char(666) character set latin2) collate latin2_general_ci as aname,
cast(ifnull(ca.ctx collate latin2_general_ci, ra.authors collate latin2_general_ci) as char(666) character set latin2) collate latin2_general_ci as authors,
cast(ifnull(cc.ctx collate latin2_general_ci, ra.commentcz collate latin2_general_ci) as char(3333) character set latin2) collate latin2_general_ci as comment,
cast(ck.ctx as char(3333) character set latin2) collate latin2_general_ci as keywords
, ra.doi, ra.doiblok, d.crstatus
from revarticles ra join magnos n using (mag, vol, no) join dois d on (ra.tartkey = d.tartkey)
left join ctx cn on (ra.tartkey = cn.artkey and cn.type = 2 and cn.paraid = 0)
left join ctx ca on (ra.tartkey = ca.artkey and ca.type = 1 and ca.paraid = 0)
left join ctx cc on (ra.tartkey = cc.artkey and cc.type = 4 and cc.paraid = 0)
left join ctx ck on (ra.tartkey = ck.artkey and ck.type = 3 and ck.paraid=0)
where status=9 and incorproofs=1 and ra.mag='www' and (n.outdate is null or n.outdate > now())
limit 30
) aaa order by pubdate desc, artkey asc limit 30
MySQL Error: 1064 (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 a.no=0
UNION
select ra.tartkey as artkey, 1 as epub, null as urlname, ra.' at line 13)
Session halted.