'Inserting values to table when column value is not exact match
I have two SQL tables with schemas like
date, league_id, team_id, value_to_be_added
19-02-2002, 256, 120, null
19-02-2002, 256, 7, null
...
25-08-2005, 3, 3, null
and
team_id, team_name, league_id
120, some_team, 256
7, other_team, 120
...
3, third_team, 3
And would like to insert values to the first table from a third table that is like
date, team_name, league_id, value_to_be_added
19-02-2002, some_tAem, 256, 8
19-02-2002, oter_team, 256, 19
But I'm having problems as the team names in the last table are not exact matches to the table where I'm supposed to insert the values. The mistakes are not due to incorrectly typed but spelled differently
I'm using Postgres as my SQL. Could anyone hint at a query that could accomplish this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|