<%
sql="select * from title as a,imgbook as b where "
if UpTime=6 then
	str="a.updatetime<=#"&formatdatetime(now-5,2)&"#"
else
	str="a.updatetime between #"&formatdatetime(now-UpTime,2)&"# and #"&formatdatetime(now-UpTime+1,2)&"#"
end if
if titleID>0 then sql=sql&"a.titleID="&titleID&" and "
if ClassID>0 then sql=sql&"a.ClassID="&ClassID&" and "
if titleNum>0 then sql=sql&"a.titleNum="&titleNum&" and "
if UpTime>=0 and UpTime<7 then sql=sql&str&" and "
if Photoer<>"" then sql=sql&"a.Photoer='"&Photoer&"' and "
if KeyWords<>"" then sql=sql&"a.titleName like '%"&KeyWords&"%' and "
sql=sql&"b.titleID=a.titleID order by b.ID desc,a.updatetime desc"
%>