This may be a simple question but I can;t find the answer anywhere. Here is an abstracted version of the problem:
- I have a table ‘Data’ which has a column named ‘Key’ and a column named ‘Value’
- I have another table ‘Users’ which has columns named ‘ID’,’Key1′,’Key2′
- I want some sort of join which will give columns ‘ID’,’Value1′, and ‘Value2’ where Value1 is the value from Key1 and Value 2 is the value from Key2.
try
you can check that it works on SQLFiddle