Foxtable(狐表)用户栏目专家坐堂 → 满足条件的计数


  共有2334人关注过本帖树形打印复制链接

主题:满足条件的计数

帅哥哟,离线,有人找我吗?
wyz20130512
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1249 积分:9480 威望:0 精华:0 注册:2013/5/12 9:22:00
  发帖心情 Post By:2018/4/20 8:36:00 [显示全部帖子]

方法一:
Dim cmd As New SQLCommand,v As Integer
cmd.Con nection Name = "数据源名称"
cmd.CommandText = "Sel ect Count(*) From {表A} Where Year(日期)=2017 And [列名] Like '%红%'"
v = cmd.ExecuteScalar
msgbox(v)

方法二:
Dim v As Integer
v = DataTables("表A").Compute("Count([_Identify])","[日期]>=#1/1/2017# And [日期]<=#12/31/2017# And [列名] Like '%红%'")
Output.Show(v)
[此贴子已经被作者于2018/4/20 9:00:31编辑过]

 回到顶部