ACCESS里使用SQL的问题,请进来看看这个SQL语句!(20分)

  • 主题发起人 主题发起人 Sammo
  • 开始时间 开始时间
S

Sammo

Unregistered / Unconfirmed
GUEST, unregistred user!
在ACCESS里好像不能使用这种子查询!请问各位老大有没有什么办法可以解决?
INSERT INTO ClienterGoodsStore (ClienterID, Clienter, GoodsName,Store, StoreTun)
SELECT ClienterID,Clienter,Name,0,0
FROM ClienterManage, GoodsCode
WHERE (ClienterID,GoodsName) NOT in (SELECT ClienterID,GoodsName FROM ClienterGoodsStore GROUP BY ClienterID,GoodsName);
 
你的values去了哪里?
insert into ... values...
 
你的出错信息是什么?看不出有什么问题?
 
出错信息是说不支持这样的子查询!
要是把这句去提就可以通过,但不能达到偶要的效果!
WHERE (ClienterID,GoodsName) NOT in (SELECT ClienterID,GoodsName FROM ClienterGoodsStore GROUP BY ClienterID,GoodsName);
 
或者把这句:
WHERE (ClienterID,GoodsName) NOT in (SELECT ClienterID,GoodsName FROM ClienterGoodsStore GROUP BY ClienterID,GoodsName);
改为:
WHERE ClienterID NOT in (SELECT ClienterID,GoodsName FROM ClienterGoodsStore GROUP BY ClienterID,GoodsName);
就可以通过,但不能达到偶要的效果!!!
 
难道ACCESS的SQL查询功能真的那么差吗?!哎~~~~~~~~~
 
把 GROUP BY ClienterID,GoodsName去掉试试
 
去掉也一样的!!它总是提示,在EXISTS里不能使用越过一个以上的字段!!
 
换中写法把
INSERT INTO ClienterGoodsStore (ClienterID, Clienter, GoodsName,Store, StoreTun)
SELECT ClienterID,Clienter,Name,0,0
FROM ClienterManage, GoodsCode
WHERE ClienterID NOT in (SELECT ClienterID FROM ClienterGoodsStore GROUP BY ClienterID)
AND GoodsName NOT in (SELECT GoodsName FROM ClienterGoodsStore GROUP BY GoodsName);

这样应该支持。
 
如果ClientID是字符型的话,可以试试换成下面这种
WHERE (ClienterID+GoodsName) NOT in (SELECT (ClienterID+GoodsName) FROM ClienterGoodsStore GROUP BY (ClienterID+GoodsName));
 
接受答案了.
 
呵呵,有是你,怎么还是上次的问题啊?不是说已经用视图搞定了么?
你的这一句
SELECT ClienterID,GoodsName FROM ClienterGoodsStore GROUP BY ClienterID,GoodsName;
中的GROUP BY ClienterID,GoodsName实际上没有什么用处,
不过去不去掉它也无所谓,因为出错的原因不在他,而在于不能一次查两个值作条件,access真是弱智。[:)]
 
To YNTW:
谢谢!!我试试去!!:)
To westboy2000:
使用视图后,这个结存无法提取呀!!!:)


为什么我的贴子已经接受答案了???????????????奇怪!!!!!
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
859
DelphiTeacher的专栏
D
I
回复
0
查看
3K
import
I
I
回复
0
查看
991
import
I
后退
顶部