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 1524841200 AND 1525618800 AND exdate IS NULL) OR exdate BETWEEN 1524841200 AND 1525618800) AND IF(exdate,exdate,edate) BETWEEN 1524841200 AND 1525618800 AND status=0 ORDER BY edate