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 2005 Forums
 Transact-SQL (2005)
 [RESOLVED] Assistance w/ a View

Author  Topic 

darms21
Yak Posting Veteran

54 Posts

Posted - 2012-04-18 : 13:15:29
I have 3 tables user1, user2 and user3.

I want a view to show all instances where user1 is not in user 2 as well as all instance where user3 is not in user2.

Any ideas?

Thanks

darms21
Yak Posting Veteran

54 Posts

Posted - 2012-04-18 : 13:17:11
each table has the field ID
Go to Top of Page

darms21
Yak Posting Veteran

54 Posts

Posted - 2012-04-18 : 13:23:13
Let me clarify a little better. I have table user2, user2 and user3. User1 is my master table. I want to show all rows from user1 that fit a where clause and that do not appear in user2. Also, I would like to show all fields from user3 that do not appear in user 2 but need user3 joined to user1 to get the name field.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-04-18 : 14:13:44
It's much easier if you supply DDL, DML and expected output in a CONSUMABLE format. Here are a couple of links to help you supply that:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

darms21
Yak Posting Veteran

54 Posts

Posted - 2012-04-18 : 14:39:01
would create statements for each table help?
Go to Top of Page

darms21
Yak Posting Veteran

54 Posts

Posted - 2012-04-18 : 16:21:56
Never mind, UNION was able to accomplish this.
Go to Top of Page
   

- Advertisement -