1.
select cgicode ||orderclass ||fcode from askquotelist where status>='70' and (asktype='01' or asktype='02')
and ( ( rtexcetodate is null and rtexcedate<=TO_DATE('11/01/2010','mm/dd/yyyy') )
or ( rtexcedate<=TO_DATE('11/01/2010','mm/dd/yyyy') and TO_DATE('11/01/2010','mm/dd/yyyy')<rtexcetodate) )
group by cgicode ,orderclass ,fcode
having count(*)>1
select count(*),cgicode ,orderclass ,fcode,destccode from askquotefob where status>='70'
and ( ( rtexcetodate is null and rtexcedate<=TO_DATE('7/01/2010','mm/dd/yyyy') ) or ( rtexcedate<=TO_DATE('7/01/2010','mm/dd/yyyy') and TO_DATE('7/01/2010','mm/dd/yyyy')<rtexcetodate) )
group by cgicode ,orderclass ,fcode ,destccode
having count(*)>1
2.
select count(*),cgicode ,orderclass ,destccode from packingcost where status>='70'
and ( ( excetodate is null and excedate<=TO_DATE('7/01/2010','mm/dd/yyyy') ) or ( excedate<=TO_DATE('7/01/2010','mm/dd/yyyy') and TO_DATE('7/01/2010','mm/dd/yyyy')<excetodate) )
group by cgicode ,orderclass ,destccode
having count(*)>1
3.
select count(*),cgicode ,orderclass ,destccode,fcode from fobupricdetail where status>='80'
and ( ( excetodate is null and odate<=TO_DATE('7/01/2010','mm/dd/yyyy') )
or ( odate<=TO_DATE('7/01/2010','mm/dd/yyyy') and TO_DATE('7/01/2010','mm/dd/yyyy')<excetodate) )
group by cgicode ,orderclass ,destccode ,fcode
having count(*)>1