I have 2 tables where depending on a value on the first one, i have to select a column on the second one.
Example
table1
data1|data2|type
P3 | C | R
P1 | D | N
P2 | C | R
P1 | C | N
P2 | D | R
P3 | D | N
table2
name|revolution|nibs
C |repeat |may
D |genocide |fill
So, I want to get the values for data1 according to the type as this (R for revolution, N for nibs)
Querying for P3:
name|value
C |repeat
D |fill
Querying for P1
name|value
C |may
D |fill
Thanks
1 Answer