Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 is this possible

Author  Topic 

neil_akoga
Yak Posting Veteran

56 Posts

Posted - 2010-03-08 : 10:34:15
ok, to settle an argument in our office and maybe help my sanity is the following possible and how would i do it.

i have 2 tables
tblUsers
userID
username
userEmail
etc

and

tblSpecialPowers
powerID
userID
specialPower
etc

now not every user will have an entry in tblSpecialPowers but i still want to join the 2 tables and bring back ALL of the entries in tblUSers as follows

userID / username / specialPower
1 / wolverine / big claws
2 / spiderman / shoots webs
3 / batman / NULL
4 / hulk / green balls
5 / ordinary man / NULL

Any help is appreciated as i can't figure a way of doing it so that i can join the 2 tables but still bring back users that don't have a special power entry?

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2010-03-08 : 10:39:13
hint: LEFT JOIN
Go to Top of Page

neil_akoga
Yak Posting Veteran

56 Posts

Posted - 2010-03-08 : 10:50:05
oh dear....lol..sorry everybody. i think my brain needs to sleep somewhere for a week or something :)
Go to Top of Page
   

- Advertisement -