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 2008 Forums
 Transact-SQL (2008)
 Select data from both tables without a join

Author  Topic 

rogerclerkwell
Yak Posting Veteran

85 Posts

Posted - 2011-09-02 : 12:54:00
I've got 2 tables one called Country
CountryName
USA
Canada
UK
Spain

and the other Products
ProductName Size
RedBike S
RedBike M
RedBike L
BlueBike 1
BlueBike 2
BlueBike 3

I want to select all data from both these tables and link them up so each country shows a product eg:

USA RedBike S
USA RedBike M
USA RedBike L
USA BlueBike 1
USA BlueBike 2
USA BlueBike 3
Canada RedBike S
Canada RedBike M
Canada RedBike L
Canada BlueBike 1
Canada BlueBike 2
and so on

Is this possible to do?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-02 : 13:01:36
just do a cross join

SELECT *
FROM Country c
CROSS JOIN Product p


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -