SELECT prodid,
currencycode,
status,
acctnbr
FROM (
SELECT a.prodid,
a.currencycode,
a.groupid,
b.status,
b.acctnbr
FROM fo_traderproductaccount_d b,
fo_group_m a
WHERE a.groupid = b.groupid
AND a.companyid = '10540'

AND b.traderid = '10580'

)



---- ---------- - --------------------
1001 CAD Y 10000000000000000004
1001 ERO Y 10000000000000000003
1001 ERO N 10000000000000000004
1001 ERO Y 100601


With the above output the "CAD" currency is existing onlyfor one account number that is
" 10000000000000000004" and other twoaccount numbers are not having so it should return the status as "N" unless all accoutnumbers with all status "Y" the status always should return
"N" only. I think u understood the problem.