//新增紀錄 if(array[13]='1' AND array[14]='1' AND (array[15]='01' OR array[15]='03') AND array[27]!='000008'){ insert into AtMoment (company,dept,consecnumber,dtlmode,dtltype,dtlfunc,itemcode,itemname,itemgrpcode,itemgrpname,itemdeptcode,itemdeptname,qty,unitprice,amt) values (array[3],array[4],array[9],array[13],array[14],array[15],array[16],array[17],array[25],array[26],array[27],array[28],array[44],array[45],array[46]); } else{ } //前75個欄位為帳單頭的資料 //購買明細63個欄位為一筆紀錄 //撈出即時帳 select sum(amt) from AtMoment where company='' and dept='' select count(consecnumber) from (select distinct consecnumber from AtMoment where company='' and dept='') select distinct itemcode,itemname,itemdeptcode,itemdeptname,sum(qty) as qty,unitprice,sum(amt) as amt from AtMoment where where company='' and dept=''