SELECT title,catname,e.eid,exid,IF(exdate,exdate,edate) edate,summary, IF(x.reserved,x.reserved,o.reserved)/IF(expersons,expersons,persons)*100, closetime FROM xc73685d_eguide e LEFT JOIN xc73685d_eguide_category c ON e.topicid=c.catid LEFT JOIN xc73685d_eguide_opt o ON e.eid=o.eid LEFT JOIN xc73685d_eguide_extent x ON e.eid=eidref WHERE ((edate BETWEEN 1496415600 AND 1497193200 AND exdate IS NULL) OR exdate BETWEEN 1496415600 AND 1497193200) AND IF(exdate,exdate,edate) BETWEEN 1496415600 AND 1497193200 AND status=0 ORDER BY edate