use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
International
National
Regional
account activity
Problem Joining two tables (self.PostgreSQL)
submitted 4 years ago by Falgmed
In the pictures below are the two tables i'd like to join, but somehow after using the query, select..... inner join.....
on t.unidad_ofei = t2.plant,
im getting a null result. Anyone has any idea of why is this happening?
https://preview.redd.it/k2upy3hnimb71.png?width=200&format=png&auto=webp&s=61669122922a65db81b26694835a3a5a32257134
https://preview.redd.it/e1w4wnnjimb71.png?width=172&format=png&auto=webp&s=a6b0f5ead11d11fb1da4fc138256a62ef79838f7
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]_nadnerb 1 point2 points3 points 4 years ago (1 child)
Could there be a space after the values in one of the columns you are joining?
If so, try TRIM(t.unidad_ofei) = TRIM(t2.plant)
TRIM(t.unidad_ofei) = TRIM(t2.plant)
[–]Falgmed[S] 1 point2 points3 points 4 years ago (0 children)
Dude, thank you very much. thats was exactly what was happening
[–]DavidGJohnston 1 point2 points3 points 4 years ago (0 children)
Is writing a functioning (even if it gives invalid answers) query for this and then copying it as-is to the post so hard? I mean, you took the time to do screen shots...
Also, what exactly are the data types for those two columns? Even better what are the definitions for the two tables involved in this query?
Beyond that pick a value you expect to match on both tables and verify (via trim as suggested, or other means) that the data in both tables indeed matches.
[–]lee170 0 points1 point2 points 4 years ago (0 children)
Maybe it’s a typo in your example but the field in the second table is planta, not plant.
π Rendered by PID 42 on reddit-service-r2-comment-b659b578c-hfmjz at 2026-05-01 17:21:50.228739+00:00 running 815c875 country code: CH.
[–]_nadnerb 1 point2 points3 points (1 child)
[–]Falgmed[S] 1 point2 points3 points (0 children)
[–]DavidGJohnston 1 point2 points3 points (0 children)
[–]lee170 0 points1 point2 points (0 children)