Ok, the only problem I can find with your code is that the column
AccNo
in
DISTINCT(AccNo)
is ambiguous.
In other words, Oracle cannot determine whether you meant the
AccNo
in
Table1
or the one in
Table2
.
So just let Oracle know which one to use. E.g.
SELECT DISTINCT(T1.AccNo),TRNO,AMOUNT