Skip to content
Advertisement

Create View based on join of column name and table value of two tables

I got two tables.

and a second

The resulting View I need would look like this:

I only managed to get it done with one column combined with a where clause:

I would probably need some command which loop through the column names and joins column names with the values in the attribute column, because the real table has many more possible combinations,so just making multiple SQL statements for every case is no solution.

How can I create a view like the above Result Table? Dissolve the values of Table Ah with keys in Table Bu.

SQL Fiddle.

Any help would be appreciated. Thanks in advance!

Advertisement

Answer

You need 3 left joins of Ah to Bu:

See the demo.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement