Foxtable(狐表)用户栏目专家坐堂 → [求助]


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

主题:[求助]

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


加好友 发短信
等级:幼狐 帖子:87 积分:662 威望:0 精华:0 注册:2013/1/24 15:19:00
[求助]  发帖心情 Post By:2013/4/10 19:14:00 [显示全部帖子]

Select Distinct Top 8000 {PRINDXDD}.ID,jgzh As [加工组号],xh As [商品序号],OTHER_FL As [包装组号],fhzh As [分货组号],dlgg As [定量规格],dzxh As [袋子型号],{SPBM}.jbdw As [基本单位],processing_spmc As [原料名称],{SPBM}.dwbm As [采购员],KCSL As [净菜库存数量],finishsp_rate As [出成率],{XSDD}.SL / {SPBM}.finishsp_rate * 100 As [订单数量/出成率],processing_spbm As [原料编码],SPJC As [商品简称],RQ As [单据日期],DJBH As [单据编号],JSR As [经手人],JHRQ As [到货日期],{XSDD}.SPBM As [商品编码],{XSDD}.SL As [基本单位之数量],pack_sl As [包装单位之数量],{PACK_UNIT}.jbdw As [订货包装单位],pack_rate As [包装单位转换率],DWJC As [订货单位简称],SPMC As [商品名称],client_spmc As [客户叫法],ZY As [订单说明],KCSL/finishsp_rate*100*-1 As [库存数量],maincompany_jc As [总公司] From ((({PRINDXDD} Left JOIN {XSDD} ON {XSDD}.[ID] = {PRINDXDD}.[ID]) Inner JOIN {WLDWBM} ON {WLDWBM}.[DWBM] = {PRINDXDD}.[DWBM]) Inner JOIN {PACK_UNIT} ON {PACK_UNIT}.[pack_id] = {XSDD}.[id_unit]) Left JOIN {SPBM} ON {SPBM}.[SPBM] = {XSDD}.[SPBM] Where {PRINDXDD}.RQ = #2013-04-01# Order By RQ DESC

请哪位帮忙看看这个查询的条件如何改成最近的一天?就是看这个日期离系统日期的最近一天。

 回到顶部
帅哥哟,离线,有人找我吗?
ruanziming
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:87 积分:662 威望:0 精华:0 注册:2013/1/24 15:19:00
  发帖心情 Post By:2013/4/11 15:57:00 [显示全部帖子]

谢谢。运行是报错。
第 1 行: ' & date.Today.Adddays(-1) & ' 附近有语法错误。

 回到顶部
帅哥哟,离线,有人找我吗?
ruanziming
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:87 积分:662 威望:0 精华:0 注册:2013/1/24 15:19:00
  发帖心情 Post By:2013/4/16 11:16:00 [显示全部帖子]

我的是SQL2000,我改了单引号后,{PRINDXDD}.RQ = ' & date.Today.Adddays(-1) & ' Order By RQ DESC   提示从字符串转换为 datetime 时发生语法错误。

 回到顶部
帅哥哟,离线,有人找我吗?
ruanziming
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:87 积分:662 威望:0 精华:0 注册:2013/1/24 15:19:00
  发帖心情 Post By:2013/4/16 18:58:00 [显示全部帖子]

从字符串转换为 datetime 时发生语法错误。
Select Distinct Top 8000 {PRINDXDD}.ID,jgzh As [加工组号],xh As [商品序号],OTHER_FL As [包装组号],fhzh As [分货组号],dlgg As [定量规格],dzxh As [袋子型号],{SPBM}.jbdw As [基本单位],processing_spmc As [原料名称],{SPBM}.dwbm As [采购员],KCSL As [净菜库存数量],finishsp_rate As [出成率],{XSDD}.SL / {SPBM}.finishsp_rate * 100 As [订单数量/出成率],processing_spbm As [原料编码],SPJC As [商品简称],RQ As [单据日期],DJBH As [单据编号],JSR As [经手人],JHRQ As [到货日期],{XSDD}.SPBM As [商品编码],{XSDD}.SL As [基本单位之数量],pack_sl As [包装单位之数量],{PACK_UNIT}.jbdw As [订货包装单位],pack_rate As [包装单位转换率],DWJC As [订货单位简称],SPMC As [商品名称],client_spmc As [客户叫法],ZY As [订单说明],KCSL/finishsp_rate*100*-1 As [库存数量],maincompany_jc As [总公司] From ((({PRINDXDD} Left JOIN {XSDD} ON {XSDD}.[ID] = {PRINDXDD}.[ID]) Inner JOIN {WLDWBM} ON {WLDWBM}.[DWBM] = {PRINDXDD}.[DWBM]) Inner JOIN {PACK_UNIT} ON {PACK_UNIT}.[pack_id] = {XSDD}.[id_unit]) Left JOIN {SPBM} ON {SPBM}.[SPBM] = {XSDD}.[SPBM] Where {PRINDXDD}.RQ = '" & date.Today.Adddays(-1) & "' Order By RQ DESC

 回到顶部
帅哥哟,离线,有人找我吗?
ruanziming
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:87 积分:662 威望:0 精华:0 注册:2013/1/24 15:19:00
  发帖心情 Post By:2013/4/17 12:00:00 [显示全部帖子]

自己顶一下,问题还没解决。

 回到顶部
帅哥哟,离线,有人找我吗?
ruanziming
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:87 积分:662 威望:0 精华:0 注册:2013/1/24 15:19:00
  发帖心情 Post By:2013/4/17 12:35:00 [显示全部帖子]

去了这个where就ok。我想写的地方没错。执行SQL啦。


 回到顶部