I am having trouble getting the correct data from a join, I am just doing something wrong but cant figure it out. Here is the scenario,
I need all from users, users.*
with the username from the user_name table that corresponds with the ssn.
I have been doing it like this:
select users.*, user_name.userid, user_name.ssn as ssncomp from users,user_name
that did not work so i tried this:
select users.* from users left join user_name on users.ssn=user_name.ssn;
this almost worked but i am getting duplicate records. same user state,city,zip,ssn but diffrent name.
Here are the Two tables:
Users
State char(2),
City char(10),
Zip char(5),
ssn char(9)----------------
user_name
ssn char(9),
userid char(10)
I cannot change the database structure or i would!
Thank you for any help.