使用ASP查询数据库的SQL,请高手指点
zhbw 2005-11-19 01:28:06 sql="select branch_txt,sum(case when type='1' then amnt else 0 end)"
sql=sql&",sum(case when type='2' then amnt else 0 end)"
sql=sql&",sum(case when type='3' then amnt else 0 end)"
sql=sql&",sum(case when type='4' then amnt else 0 end)"
sql=sql&",sum(case when type='5' then amnt else 0 end)"
sql=sql&" from tmptj a,br001 b"
sql=sql&" where pl_date between '"&chdt(sdate)&"' and '"&chdt(edate)&"' "
sql=sql&" and a.branchno[1,4]='"&brch&"' and a.branch=b.branch_no"
执行后报“基本语法错”,但是将将上面的SQL在数据库上直接运行后成功。
是否为ASP中不存在有case when ... then ...end语法的,
请指教