以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  SEL语句中的动态合成表达式  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=144427)

--  作者:lfz123
--  发布时间:2019/12/19 16:06:00
--  SEL语句中的动态合成表达式
老师请帮我看下,合成表达式中,月份和年份都是整数,怎样正确编写
Dim filter As String = "[年份] = " & dr("年份") & "and [月份] = " & dr("月份") & " And 税率 <> " 0.03  
cmd.CommandText = "S elect count(*) As 份数, sum(金额) As 金额,sum(税额) As 税额,sum(金额 + 税额) As 价税合计 from {销项发票} where filter"

--  作者:有点蓝
--  发布时间:2019/12/19 16:10:00
--  
这个帮助建议先看10遍:http://www.foxtable.com/webhelp/topics/1284.htm

Dim filter As String = "[年份] = " & dr("年份") & " and [月份] = " & dr("月份") & " And 税率 <>  0.03 " 
cmd.CommandText = "S elect count(*) As 份数, sum(金额) As 金额,sum(税额) As 税额,sum(金额 + 税额) As 价税合计 from {销项发票} where " & filter