Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to SELECT * FROM two unassociated tables?

Status
Not open for further replies.

Curtis360it

IS-IT--Management
Nov 7, 2005
88
US
If I have two tables with zero association, can I do a SELECT query to pull all rows from both tables?

Example:

SELECT *
FROM House,Apartment
 
example in pubs by using a full outer join, what you are doing is a cross join and for every row in one table all rows in the otherv tbale will be selected

Code:
use pubs
go

select * from authors a 
full outer join publishers p on a.au_id = p.pub_id

cross join

Code:
use pubs
go

select * from authors ,publishers


if the tables have the same number off columns you could do a union


Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning
SQLBlog.com, Google Interview Questions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top