不知道是不是ADO的BUG,请仙人指点(100分)

  • 主题发起人 主题发起人 mtj
  • 开始时间 开始时间
M

mtj

Unregistered / Unconfirmed
GUEST, unregistred user!
为什么形如
SELECT FIELD1,(SELECT COUNT(*) FROM TABLE1 WHERE TABLE1。FIELD1=TABLE2。FIELD1) FROM TABLE2
的SQL语句
1。在SQL SERVER中能够执行,
2。而在程序中通过BDE可以,
3。ADO就不行了
 
没有道理呀,应该可以的
什么错误?
是不是你其他地方的问题?
 
应该不会有问题,把错误贴出来!
 
我不骗你们,要不你做一个测试,还有我怎么看我的ADO版本,我的系统WINDOWS 2000
 
我可以保证SQL语句没有问题 D6+SQL SERVER 7 + WINDOWS2000

SELECT A.流水号,B.维修员号,C.服务费,C.材料费,C.费用合计,C.返单日期,C.返单操作员,A.故障现象,C.用户满意度 ,
(SELECT CASE COUNT(*)
WHEN 0 THEN ''
WHEN 1 THEN (SELECT 零件名称 FROM PART_INFO WHERE A.流水号=PART_INFO.流水号)
WHEN 2 THEN (SELECT RTRIM(PART_INFO1.零件名称)+ ',' + RTRIM(PART_INFO2.零件名称) FROM PART_INFO AS PART_INFO1,PART_INFO AS PART_INFO2 WHERE A.流水号=PART_INFO1.流水号 AND A.流水号=PART_INFO2.流水号 AND PART_INFO1.序号<PART_INFO2.序号)
WHEN 3 THEN (SELECT RTRIM(PART_INFO1.零件名称)+ ',' + RTRIM(PART_INFO2.零件名称) + ',' + RTRIM(PART_INFO3.零件名称)FROM PART_INFO AS PART_INFO1,PART_INFO AS PART_INFO2,PART_INFO AS PART_INFO3 WHERE A.流水号=PART_INFO1.流水号 AND A.流水号=PART_INFO2.流水号 AND A.流水号=PART_INFO3.流水号 AND PART_INFO1.序号<PART_INFO2.序号 AND PART_INFO2.序号<PART_INFO3.序号)
WHEN 4 THEN (SELECT RTRIM(PART_INFO1.零件名称)+','+RTRIM(PART_INFO2.零件名称)+','+RTRIM(PART_INFO3.零件名称)+','+RTRIM(PART_INFO4.零件名称) FROM PART_INFO AS PART_INFO1,PART_INFO AS PART_INFO2,PART_INFO AS PART_INFO3,PART_INFO AS PART_INFO4 WHERE A.流水号=PART_INFO1.流水号 AND A.流水号=PART_INFO2.流水号 AND A.流水号=PART_INFO3.流水号 AND A.流水号=PART_INFO4.流水号 AND PART_INFO1.序号<PART_INFO2.序号 AND PART_INFO2.序号<PART_INFO3.序号 AND PART_INFO3.序号<PART_INFO4.序号)
ELSE '<<零件过多,无法显示>>' END
FROM PART_INFO AS D WHERE A.流水号=D.流水号) AS 零件名称
FROM REC_INFO AS A,SEND_INFO AS B,RET_INFO AS C WHERE A.安装单='√' AND (C.返单日期 BETWEEN :FROM AND :TO) AND A.流水号=B.流水号 AND A.流水号=C.流水号

ERROR Message:The column prefix 'C' does not match with a table name or alias name used in the query
报告不认识c前缀
 
from语句中有 "as" ? 把 as去掉应该就可以了。
你把 FROM REC_INFO AS A,SEND_INFO AS B,RET_INFO AS C 改为以下试试:
FROM REC_INFO A,SEND_INFO B,RET_INFO C
 
End后加个AS DDD也就是给它取个名字了。因为太长了,至少Oracle里有这个问题。
你不妨试试。
 
awind616:你对了,但是为什么?还是本来就没有为什么?
 
其它就只能谢谢了
 

Similar threads

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