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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-08-09 : 08:22:07
|
| John writes "I have an instance where I have 4 tables that all contain the same field. I want to build a sql statement that does not return duplicates from all the tables for 1 field.Example: Select distinct assignee_email from PTRDOC, PTRHW, PTRSW, PTRSYSSince the field is in all 4 tables it returns errors saying it the field can be in multiple tables. I am thinking I am going to have to make use of the join statement but I am not sure.Thanks,John" |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2002-08-09 : 08:46:01
|
| I'm not sure what you're asking for.Perhaps this?SELECT assignee_email FROM PTRDOCUNIONSELECT assignee_email FROM PTRHWUNIONSELECT assignee_email FROM PTRSWUNIONSELECT assignee_email FROM PTRSYS |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-08-09 : 08:46:48
|
select assignee_email from PTRDOCunionselect assignee_email from PTRHWunionselect assignee_email from PTRSWunionselect assignee_email from PTRSYS Now, I am afraid to ask why this query must exists. If assignee_email is a fk referencing some 5th table, you should be able to simple select from that table. Apparently, it's not, meaning you may have some design issues.Jay White{0} |
 |
|
|
|
|
|