常规的多条件查询可以写成这样
求助下面的临时表查询怎么能实现上面这样的查询方式
照这样写下去太乱了,看的眼都花了,我的条件有很多。
<%
set rs= server.CreateObject("adodb.recordset")
if fl1=0 then sql ="select * from tuku where img<>''"
if fl2<>0 and fl2<>"" then sql=sql&" and kj="&fl2
if fl3<>0 and fl3<>"" then sql=sql&" and fg="&fl3
if fl4<>0 and fl4<>"" then sql=sql&" and zj="&fl4
if fl5<>0 and fl5<>"" then sql=sql&" and ys="&fl5
if fl6<>0 and fl6<>"" then sql=sql&" and hx="&fl6
rs.open sql,conn,1,1
if rs.eof then%>
求助下面的临时表查询怎么能实现上面这样的查询方式
<%if l1=0 and l2=0 then
sql2="select xx.* from picture as xx,(select tid,min([px]) as zz from picture group by tid) as yy where xx.tid=yy.tid and xx.px=yy.zz"
elseif l2>0 and l3=0 then
sql2="select xx.* from picture as xx,(select tid,min([px]) as zz from picture where lb="&l2&" group by tid) as yy where xx.tid=yy.tid and xx.px=yy.zz and xx.lb="&l2&""
elseif l3>0 and l4=0 then
%>
照这样写下去太乱了,看的眼都花了,我的条件有很多。