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


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

主题:[求助]

帅哥哟,离线,有人找我吗?
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

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

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2013/4/10 23:07: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 = #" & date.Today.Adddays(-1) & "# Order By RQ DESC"

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


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

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

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


加好友 发短信
等级:等待验证 帖子:3855 积分:20692 威望:0 精华:5 注册:2012/6/21 14:03:00
  发帖心情 Post By:2013/4/11 15:59:00 [只看该作者]

用户已被锁定

 回到顶部
帅哥哟,离线,有人找我吗?
ruanziming
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | 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 时发生语法错误。

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


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2013/4/16 11:18:00 [只看该作者]

不可以这样直接加..  要改为如下
{PRINDXDD}.RQ = '" & date.Today.Adddays(-1) & "' Order By RQ DESC

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


加好友 发短信
等级:等待验证 帖子:3855 积分:20692 威望:0 精华:5 注册:2012/6/21 14:03:00
  发帖心情 Post By:2013/4/16 11:22:00 [只看该作者]

用户已被锁定

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


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2013/4/16 11:24:00 [只看该作者]

以下是引用muhua在2013-4-16 11:22:00的发言:
是把 # 改, 双引号不用改。

5楼不是说改了不行么.报错无法转换啊.

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


加好友 发短信
等级:等待验证 帖子:3855 积分:20692 威望:0 精华:5 注册:2012/6/21 14:03:00
  发帖心情 Post By:2013/4/16 11:26:00 [只看该作者]

用户已被锁定

 回到顶部
帅哥哟,离线,有人找我吗?
ruanziming
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | 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

 回到顶部
总数 14 1 2 下一页