I have a query as follows:
select a.* from a join b on a.aa=b.aa;
I would like to select only the records of a that satisfy the above join but not doubling them if there are two records in b that satisfy a.aa=b.aa.
By issuing
select distinct a.* from a join b on a.aa=b.aa;
you have a deduplication of the results, but based on the values involved and not on a record basis, so if e.g. by chance two records have the same values then the result will not contain all records but one less.
I could issue
select * from a where a.aa in (select b.aa from b);
but it seems a little bit inefficient. I suppose that but I may be wrong, so if you know more please clarify !
I am wandering if there does exist any other way I mean something similar to the imaginary:
select distinct records a.* from a join b on a.aa=b.aa;