I have two tables in database:
A: [ ID, name, SECRET_KEY]
examplary rows:
ID1, John, X
ID2, Jane, Y
and second ( 'dictionary')
B: [SECRET_KEY, explanation]
like:
X, Driver
Y, Doctor
i want to list all records from table A but with secret_key开发者_开发知识库 translated to it's explanation ( based on relation from table B).
expected result:
ID1, John, Driver
ID2, Jane, Doctor
I suppose it is very easy but i cannot figue how to do it based on wc3 tutorials :-|. I would be glad if u share with me link to good sql tutorial too.
thanks.
select A.ID, A.name, B.Explaination
from A inner Join B On A.Secret_Key = B.Secret_Key
SELECT a.ID, a.name, b.explanation
FROM a LEFT JOIN b USING(secret_key)
精彩评论