If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

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 .

Try this. You have to select shipto.strfnbr from one of the subqueries or another table in order to do a count on it. If you add it to one of your subqueries just add the appropriate letter in front of it. You don't have to do the count and the sum in the main query because you already did it in the subquery.