I have 2 tables, t1 and t2, t1 holds aliases and scores, while t2 holds aliases and their real names, I wish to build a query to get the scores,real names and aliases (example - desired results)
t1
alias - scores - tl_alias - tm_alias (column names)
tk - 96 - pp - jj
sp - 94 - pp - jj
t2
name - alias - role (column names)
tom Koshy - tk - user
shaun penn - sp - user
peter pan - pp - tl
john james - jj - tm
Desired Result
user_alias - user_name - scores - tl_alias - tl_name - tm_alias - tm_name (column labels)
tk - tom koshy - 96 - pp - peter pan - jj - john james
sp - shaun penn - 94 - pp - peter pan - jj - john james
Current Results
The below query gives me tl_name for all instances of t2.name in the query which I think is correct as per the query but what I would like to have is, the first instance of t2.name should show the user_name, then next instance should show the tl_name and then the tm_name
SELECT t1.alias,t2.name,t1.scores,t1.tl_alias,t2.name,t1.tm_alias,t2.name from t1 JOIN t2 on t1.tl_alias = t2.alias
tk - peter pan - 96 - pp - peter pan - jj - peter pan
sp - peter pan - 94 - pp - peter pan - jj - peter pan
The below does not work either
SELECT t1.alias,t2.name,t1.scores,t1.tl_alias,t2.name,t1.tm_alias,t2.name from t1 JOIN t2 on t1.tl_alias = t2.alias, t1.tm_alias = t2.alias