Foxtable(狐表)用户栏目专家坐堂 → 表达式


  共有2640人关注过本帖平板打印复制链接

主题:表达式

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


加好友 发短信
等级:幼狐 帖子:196 积分:1357 威望:0 精华:0 注册:2015/3/25 16:42:00
表达式  发帖心情 Post By:2015/9/10 10:18:00 [只看该作者]

cmd.CommandText = "select sys_user, year(日期) as 日期_年, month(日期) as 日期_月, sum(头数) as 日龄_0至30, sum(头数1) as 日龄_30至60, sum(头数2) as 日龄_60至90, sum(头数3) as 日龄_90至120, " & _
"sum(头数4) As 日龄_120至150, sum(头数5) As 日龄_150至180, sum(头数6) As 日龄_180至210, sum(头数7) As 日龄_210至240, sum(头数8) As 日龄_240至270, sum(头数9) As 日龄_270至300, count(头数10) as 母猪, count(头数11) as 公猪 f rom " & _
"(Select  sys_user, 日期, 头数, 0 As 头数1, 0 As 头数2, 0 As 头数3, 0 As 头数4, 0 As 头数5, 0 As 头数6, 0 As 头数7, 0 As 头数8, 0 As 头数9, 0 as 头数10, 0 as 头数11  f rom {死亡淘汰} where [肉猪日龄_低]= 0 u nion all " & _
"select  sys_user, 日期, 0, 头数, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  f rom {死亡淘汰} where [肉猪日龄_低]= 30 and 猪只类型='肉猪' u nion all " & _
"select  sys_user, 日期, 0, 0, 头数, 0, 0, 0, 0, 0, 0, 0, 0, 0  f rom {死亡淘汰} where [肉猪日龄_低]= 60 and 猪只类型='肉猪' u nion all " & _
"select  sys_user, 日期, 0, 0, 0, 头数, 0, 0, 0, 0, 0, 0, 0, 0  f rom {死亡淘汰} where [肉猪日龄_低]= 90 and 猪只类型='肉猪' u nion all " & _
"select  sys_user, 日期, 0, 0, 0, 0, 头数, 0, 0, 0, 0, 0, 0, 0  f rom {死亡淘汰} where [肉猪日龄_低]= 120 and 猪只类型='肉猪' u nion all " & _
"select  sys_user, 日期, 0, 0, 0, 0, 0, 头数, 0, 0, 0, 0, 0, 0  f rom {死亡淘汰} where [肉猪日龄_低]= 150 and 猪只类型='肉猪' u nion all " & _
"select  sys_user, 日期, 0, 0, 0, 0, 0, 0, 头数, 0, 0, 0, 0, 0  f rom {死亡淘汰} where [肉猪日龄_低]= 180 and 猪只类型='肉猪' u nion all " & _
"select  sys_user, 日期, 0, 0, 0, 0, 0, 0, 0, 头数, 0, 0, 0, 0  f rom {死亡淘汰} where [肉猪日龄_低]= 210 and 猪只类型='肉猪' u nion all " & _
"select  sys_user, 日期, 0, 0, 0, 0, 0, 0, 0, 0, 头数, 0, 0, 0  f rom {死亡淘汰} where [肉猪日龄_低]= 240 and 猪只类型='肉猪' u nion all " & _
"select  sys_user, 日期, 0, 0, 0, 0, 0, 0, 0, 0, 0, 头数, 0, 0  f rom {死亡淘汰} where [肉猪日龄_低]= 270 and 猪只类型='肉猪' u nion all " & _
"select  sys_user, 日期, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 编号, 0  f rom {死亡淘汰} where  猪只类型 = '母猪' u nion all " & _
"select  sys_user, 日期, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 编号  f rom {死亡淘汰} where  猪只类型 = '公猪'  ) " & _

"as a where [sys_user]='" & user.Name & "' and 日期 between '" & d1 & "' and '" & d2 & "' group by sys_user, year(日期), month(日期) order by year(日期), month(日期) "
dt = cmd.ExecuteReader

请问老师,上面代码的错误提示说:黄色部分为编译错误,应该表达式,该怎么改

 回到顶部