我可以保证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前缀