I've created 2 SQL queries, the results are in the picture below. In the result table 1, you can see that there are variables in the columns "lower limit" and "upper limit". Now I'd like to replace these variables with values (column "limit") of result table 2.
How can I do this?
Thank you!
I tried to user the "join" function, but it didn't work out.
CodePudding user response:
I'd use two joins, one for the lower limit and one for the upper limit:
SELECT material, order, value, l.limit, u.limit
FROM result1 r
JOIN result2 l ON r.lower_limit = l.name
JOIN result2 u ON r.upper_limit = u.name