with the left join all the rows in the left table will be in the output and only the rows in the right table that match will be joined in the output
if you just want the rows that match use an inner join
If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution. Thank you.
i want all the rows in the left table with the rows in the right table that match, it´s for that, that i think the result would be 5136 rows instead 5188 rows.
You are likely getting some duplication of rows. In your example above you get 50+ extra rows and I suspect it's because rows on the left are finding multiple matches on the right.
To illustrate, consider these two tables:
ID Value A 1 B 2 C 3
ID Color A Red B Blue B Black C Green
If you left joined on ID and Table 1 was your left table, then you'd get the following Rows:
ID Value Color A 1 Red B 2 Blue B 2 Black C 3 Green
So you'd end up with 4 rows even though your left table only had 3.
You'll need to make sure that the right table doesn't contain duplicate key values for the match (Fecha and Hora) in your example. You can potentially use an aggregation prior to the join to fix that, but it might depend a bit on your original data.
On a related note, notice that NULL values never match, so if you did want to retain them from the left side, you'll need to change them to another value first.
Hope that helps!
A true left join should be take all the rows in my left table and match to my right if it does not match put a null row. I am working with another customer who is saying that the left join is not working properly in Prep and based on this example above.. I agree with original question if you have 5000 rows in Left table... you should get a result of 5000 rows in your result set. Prep seems to be inflating the results, when it should not. Please advise.
Hi Johannah Villa,
In my case it was because i contained duplicate key values, you´ll need to make sure that. i think that is the mistake.
Hope that helps.
These happen due to having a repeated value in column of the secondary table
in which you apply to join . Make sure their no repeated values.
On Sat, Mar 9, 2019 at 7:56 AM Johannah Villa <firstname.lastname@example.org>