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)
 2 tables AS 1 Query?

Author  Topic 

Shanew
Starting Member

20 Posts

Posted - 2009-04-28 : 19:19:39
Hello,

This must be a simple thing and I’m just not getting it.

I have 2 tables both with the same field names:
Table1 (Fname, Lname, Age)
Table2 (Fname, Lname, Age)

I want a query that displays Fname, Lname and Age from both tables.

Select * from Table1 and Table2... (No such luck) what am I doing wrong?

Thanks for the help
Shane

mfemenel
Professor Frink

1421 Posts

Posted - 2009-04-28 : 19:30:45
select fname,lname,age from table1
UNION ALL
select fname, lname, age from table2

Mike
"oh, that monkey is going to pay"
Go to Top of Page

Shanew
Starting Member

20 Posts

Posted - 2009-04-28 : 20:22:02
Thanks Mike!

"UNION ALL" was just what I needed.

Shane

Shane Weddle
www.TechKnowPros.com
Go to Top of Page
   

- Advertisement -