Wrox Programmer Forums
|
BOOK: Professional SQL Server 2000 Programming
This is the forum to discuss the Wrox book Professional SQL Server 2000 Programming by Robert Vieira; ISBN: 9780764543791
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional SQL Server 2000 Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 12th, 2003, 10:20 AM
Registered User
 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Outer Joins

Hi

I have two tables that I'm joining together using a RIGHT OUTER JOIN as below:

SELECT tbl1.RatingID, tbl4.RatingTypeID
FROM DataRating As tbl1 RIGHT OUTER JOIN
DataTypeOfRating As tbl4 ON tbl1.RatingTypeNameID = tbl4.RatingTypeID

The DataTypeOfRating Contains 16 entries and the DataRating a few thousand. I do not seem to be getting all the entries in DataTypeOfRating each time. The result set seems more like an INNER JOIN - can somebody please tell me what I'm doing wrong. I've enclosed a few entries from the result set below:

561851|1
561852|2
561853|3
561854|4
561855|5
561856|6
561857|7
561858|8
561859|9
561860|10
561861|11
561862|12
561863|13
561864|14
561866|2
561867|3
561868|4
561869|5
561870|6
561871|7
561872|8
561873|9
561874|10
561875|11
561876|12

Thanks

Nick
 
Old June 20th, 2003, 10:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you want to return all rows from one table for each row in another table, leave out the JOIN clause altogether:

Code:
SELECT tbl1.RatingID, tbl4.RatingTypeID
FROM DataRating AS tbl1, DataTypeOfRating As tbl4
This will give you a result set similar to the following:

Code:
561851|1
561851|2
561851|3
561851|4
561851|5
561851|6
561851|7
561851|8
561851|9
561851|10
561851|11
561851|12
561851|13
561851|14
561852|1
561852|2
...
Is that what you wanted?

Regards
Owain Williams





Similar Threads
Thread Thread Starter Forum Replies Last Post
CR XI left outer joins not working saied80 Crystal Reports 0 January 17th, 2007 12:41 PM
SQL - Help with Joins oldmuttonhead Classic ASP Databases 0 January 21st, 2006 05:02 PM
T-SQL Outer join query jaucourt SQL Server 2000 5 June 2nd, 2004 10:56 AM
Two outer joins Neil SQL Language 1 March 22nd, 2004 01:09 PM
SQL Table Joins Dredd Classic ASP Databases 2 June 3rd, 2003 06:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.