I'm having some trouble with LEFT and RIGHT JOIN.
queries I've tried:
1.
Code: Select all
select user_number, user_name, user_branch_cd from uni_bw_usr right join (select user_name as template_name from bw_templates) on uni_bw_usr.user_level = bw_templates.user_levelCode: Select all
select user_number, user_name, user_branch_cd from uni_bw_usr join bw_templates.user_name on uni_bw_usr.user_level = bw_templates.user_level
on query 2 I get error: 'bw_templates.user_name' doesn't exist
I've tried other queries but the user_name column of uni_bw_usr is overwritten with the user_name column of bw_templates and the user_name column is duplicated for every instance of the "ON"
All I want to do is to select the user_number, user_name and user_branch_cd column from the uni_bw_usr table and right join the user_name column of the bw_templates tables as column template_name so that the output will look something like:
_____________________________________________________
user_number | user_name | user_branch_cd | template_name |
------------------------------------------------------------
Can someone please assist me?
P.S. both the tables are located in the same DB