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
 Displaying Data from 3 tables

Author  Topic 

Atrophybrain
Starting Member

7 Posts

Posted - 2011-03-30 : 19:19:38
Hey,

I'm probably just missing something obvious here, but here's my problem:

I have three tables named group1, group2, and group3 that all have columns in common (day,person #,score). The combination of the day and person columns will always be unique. What I'd like to do is display all entries from all three groups with one query, but I tried a few different ways, and it would either not execute with a "Ambiguous columns" error, or I'd lose it in the planning stages.

Any ideas? Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-03-30 : 19:21:03
Can't you just use a UNION?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Atrophybrain
Starting Member

7 Posts

Posted - 2011-03-31 : 12:31:26
...aaand that's the something obvious I was missing.
Thanks Tara, that's exactly what I was needing!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-03-31 : 12:49:05
You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -