select dept_name,
sum(decode(laser_chk,'Y',out_amt,0)) LASER,
sum(decode(laser_chk,'Y',out_amt*cost,0)) LASET_COST,
sum(decode(laser_chk,'N',decode(color_chk,'B',out_amt,0),0)) BK_INK,
sum(decode(laser_chk,'N',decode(color_chk,'B',out_amt*cost,0),0)) BK_COST,
sum(decode(laser_chk,'N',decode(color_chk,'C',out_amt,0),0)) CO_INK,
sum(decode(laser_chk,'N',decode(color_chk,'C',out_amt*cost,0),0)) CO_COST,
sum(out_amt) TOTAL_AMT, sum(out_amt*cost) TOTAL_COST
from somo_mst, somo_out, insa_tm_view
where somo_mst.code=somo_out.code
and somo_mst.gubun=somo_out.gubun
and somo_out.out_dept_code=insa_tm_view.dept_code
and out_date like :input_date || '%'
and somo_mst.gubun='65'
and pum_gu='1'
group by dept_name
order by TOTAL_COST desc
위와 같은 query문을 Delphi에서 사용하고자 합니다.
보통 '와 같은 것은 +#39+와 같이 쓰더군요
계속 에러가 나서 못잡고 있습니다.
알려 주세요~~
|