导航
  • 主页
  • 基础类
  • 应用实例
  • 新技术前沿

高手来找错,高分!!

lzwdy 2003-01-01 09:00:10
现有如下SQL语句:
SELECT A.PDT_ID,A.PDT_NAME,B.quan AS 数量, B.pri AS 单价, B.cn AS 金额,C.quan as 数量1,C.pri as 单价1,C.cn as 金额1
FROM PDT_TABLE AS A
LEFT JOIN
(
SELECT PDT_ID, sum(quantity) AS quan, sum(cnt)/sum(quantity) AS pri, sum(cnt) AS cn
FROM XSFP_TABLE GROUP BY pdt_id
)
AS B
ON A.pdt_id=B.pdt_id
LEFT JOIN
(
SELECT PDT_ID, sum(quantity) AS quan, sum(cnt)/sum(quantity) AS pri, sum(cnt) AS cn
FROM XSFP_TABLE
WHERE crea_date>#10/1/2002# And crea_date<#10/31/2002#
GROUP BY pdt_id
)
AS C
ON A.pdt_id = C.pdt_id
提示的错误是:
A.pdt_id=B.pdt_id
LEFT JOIN
(
SELECT PDT_ID, sum(quantity) AS quan, sum(cnt)/sum(quantity) AS pri, sum(cnt) AS cn
FROM XSFP_TABLE
WHERE crea_date>#10/1/2002# And crea_date<#10/31/2002#
GROUP BY pdt_id
)
AS C
ON A.pdt_id = C.pdt_id
这部分“操作符丢失”,偶百思不得其解,希望各位达人指点迷津
PS:
1。偶用的是ACCESS
2。把最后一句改成ON B.pdt_id = C.pdt_id也不行,提示还是“操作符丢失”
...全文
42 点赞 收藏 4
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzwdy 2003-01-02
上面写错了一点,错误提示是
A.pdt_id=B.pdt_id
LEFT JOIN
(
SELECT PDT_ID, sum(quantity) AS quan, sum(cnt)/sum(quantity) AS pri, sum(cnt) AS cn
FROM XSFP_TABLE
WHERE crea_date>#10/1/2002#
这段“操作符丢失“
回复
可能与ACCESS的选项参数有关,查找有关参数,将其调大些。
回复
jinyefeng 2003-01-02
你这样只能文本类型比较。好想可以用between in来处理哦
回复
jinyefeng 2003-01-02
在access里,不能这样的日期比较的 哦
回复
发动态
发帖子
MS-SQL Server
创建于2007-09-28

3.2w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
社区公告
暂无公告