3
I have two tables: one with 1009 records and another 11949. When I do a Join, I have 11949 records, of which 1009 table records are repeated several times. I need to select with Join, but bring only the amount of records contained in the smallest table, because everything that exists in the smallest table exists in the largest. Down with my select:
select er.id_exm_rea
from t_cmo_Exame_Realizado er
inner join t_cmo_planilha_leitura pl on er.id_xfc = pl.id_xfc
t_cmo_worksheet -> Smaller table(1009 records)
t_cmo_Exame_Realized -> Larger Table(11949 records)
You want all the information that is on the table t_cmo_worksheet reading plus the information of qnts times it appears in the table t_cmo_Exame_Realizado, that’s it?
– Jeferson Almeida
I’d just like to know why I return 11,000 records and not 1009?
– pnet
Pq qnd vc performs the Join of one table with the other will always bring all the lines that were connected by Join and in your case, all 11949 records met the condition of your Join and so were returned.
– Jeferson Almeida