SELECT prod.id,prod.dataXML,prod.imgXML FROM 201400220_product prod,201400220_product_cate cate WHERE prod.cateid = cate.id and (prod.inuse in ('1') or (prod.inuse='2' and prod.sdate <= '2018-06-20' and prod.edate >='2018-06-20')) and prod.cateid=12 order by cate.seq asc,prod.seq desc