M
manzyj
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大俠﹕
三層中client端我用socket方式連接﹐用clientDateSet下sql語句﹐如下﹕
SQLSTR:=' SELECT A.EQUIP_TYPE_NO,D.TYPE_DES,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'01'') as jan,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'02'') as feb,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'03'') as mar,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'04'') as APR,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'05'') as MAY,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'06'') as JUN,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'07'') as JUL,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'08'') as AUG,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'09'') as SEP,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'10'') as OCT,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'11'') as NOV,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'12'') as DEC '
+' FROM OUTPUT_SALES A,EQUIP_TYPE D WHERE A.EQUIP_TYPE_NO=D.TYPE_ID(+) and A.TYPE_NO=''A'' and a.division_no in ('+role_range_str+') GROUP BY A.EQUIP_TYPE_NO,D.TYPE_DES ORDER BY A.EQUIP_TYPE_NO';
可open以后﹐取不出數據﹐出現以下提示錯誤﹕”value of field is out of range“﹐請注意我的sql中sum這個函數
請指教﹐不勝感謝﹗我的mail是﹕manzyj@sina.com
三層中client端我用socket方式連接﹐用clientDateSet下sql語句﹐如下﹕
SQLSTR:=' SELECT A.EQUIP_TYPE_NO,D.TYPE_DES,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'01'') as jan,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'02'') as feb,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'03'') as mar,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'04'') as APR,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'05'') as MAY,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'06'') as JUN,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'07'') as JUL,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'08'') as AUG,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'09'') as SEP,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'10'') as OCT,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'11'') as NOV,'
+' (select sum(quantity) from oUTPUT_SALES b where a.EQUIP_TYPE_NO=b.EQUIP_TYPE_NO and b.type_no=''A'' and year_month like '''+copy(trim(year.text),3,4)+'12'') as DEC '
+' FROM OUTPUT_SALES A,EQUIP_TYPE D WHERE A.EQUIP_TYPE_NO=D.TYPE_ID(+) and A.TYPE_NO=''A'' and a.division_no in ('+role_range_str+') GROUP BY A.EQUIP_TYPE_NO,D.TYPE_DES ORDER BY A.EQUIP_TYPE_NO';
可open以后﹐取不出數據﹐出現以下提示錯誤﹕”value of field is out of range“﹐請注意我的sql中sum這個函數
請指教﹐不勝感謝﹗我的mail是﹕manzyj@sina.com