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
 General SQL Server Forums
 New to SQL Server Programming
 Challenge with a 3 three table view

Author  Topic 

eazygng
Starting Member

6 Posts

Posted - 2012-02-02 : 05:14:39
Hi everyone,
Please i need help with a problem am having

I have 3 table as below

user
UserID
FirstName
LastName

childuser
------------
childuserID
UserID
FirstName
LastName
State

UserState
----------
State
UserID

I want a view or select statement that will be as below(3 colum table) of all the users and childusers.

fisrtname lastname state
------------ ----------- --------
user a abc
user b cd
childuser a abc

Not all users have childusers... when i ve tried an inner join which gives me only those with children.

Please your feedbacks wil be appreciated
thank you

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-02-02 : 05:33:11
Try UNION or UNION ALL instead of join to get rows.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-02 : 10:09:11
does childuser represent subset of user? or is it different set of users?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -