select count(orrfnbr),sum(orprtot) ,count(shipto.strfnbr) from
(
select count(orrfnbr) ,sum(orprtot) from
(
Select distinct orders.orrfnbr, orders.orprtot
FROM
ordpaymthd , orders
WHERE
ordpaymthd.omornbr = orders.orrfnbr
AND ordpaymthd.ompaymthd !='FR'
AND ordpaymthd.ompaymthd !='SW'
AND orders.orstat='C'
and trunc(shipto.sttrkdate) = '01-JAN-01'
AND orders.orrfnbr = shipto.stornbr))


I need to make this work , selecting distinct of orrfnbr ,orprtot from ordpaymthd , orders
and then calculating count and sum for the respectively and then to check out from SHIPTO
table how many items for that .


Thanks