tags:

views:

23

answers:

2

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.

A: 
SELECT a.ID, a.name, b.explanation
  FROM a LEFT JOIN b USING(secret_key)
Michał Pękała
+2  A: 
select A.ID, A.name, B.Explaination 
from A inner Join B On A.Secret_Key = B.Secret_Key
Sachin Shanbhag