SELECT * FROM ( select cast(year(dinvoice)as char) as csalesyear, replicate('0', 2 - len(cast(month(dinvoice) as char) )) + cast(month(dinvoice) as char) as csalesmonth from arinvc left outer join aritrs on (arinvc.ccustno = aritrs.ccustno and arinvc.cinvno = aritrs.cinvno) where arinvc.lvoid = 0 and arinvc.cinvno <> 'BAL F/W' and (ARINVC.CSLPNNO = 'CAROL' and ARINVC.DINVOICE >= '2006-01-01' and ARINVC.DINVOICE <= '2007-01-31' and ARITRS.CITEMNO IN (SELECT citemno from sr_items_in_group where citemgroup='PROSTATFAMILY')) ) dt1 group by csalesyear, csalesmonth order by csalesyear, csalesmonth>The following query fails in QA:
>select cast(year(dinvoice)as char) as csalesyear, replicate('0', 2 - len(cast(month(dinvoice) as char) )) + > cast(month(dinvoice) as char) as csalesmonth > from arinvc >left outer join aritrs on (arinvc.ccustno = aritrs.ccustno and arinvc.cinvno = aritrs.cinvno) >where arinvc.lvoid = 0 and arinvc.cinvno <> 'BAL F/W' and >(ARINVC.CSLPNNO = 'CAROL' and ARINVC.DINVOICE >= '2006-01-01' and ARINVC.DINVOICE <= '2007-01-31' >and ARITRS.CITEMNO IN (SELECT citemno from sr_items_in_group where citemgroup='PROSTATFAMILY')) >group by year(dinvoice), month(dinvoice) order by year(dinvoice), month(dinvoice)>The error messages are: