sql="select * from tables where id<>0 "
if uid<>"" then sql=sql&" and uid=1 "
if uid2<>"" then sql=sql&" and uid2=1 "
if uid3<>"" then sql=sql&" and uid3=1 "
上边的连接是大家常用到的,下边是针对排序的.
if uid="1" then ostr=ostr&" ,uid desc "
if uid="2" then ostr=ostr&" ,uid "
if uid2="1" then ostr=ostr&" ,uid2 desc "
if uid2="2" then ostr=ostr&" ,uid2 "
if uid3="1" then ostr=ostr&" ,uid3 desc "
if uid3="2" then ostr=ostr&" ,uid 3 "
ostr=mid(ostr,1) '这一步的作用是,以前的取排序操作字段的时候没有考虑:这个字段前边是不是已经有一个了,现在不用考虑,直接写到最后把前边的那个", "用mid去掉就行
if len(trim(ostr))<>0 then
sql=sql&" order by "&ostr
end if