#1  
Old 31st January 2004, 03:14 PM
Mark Clark
 
Posts: n/a
Default Right Join with a not null

I am trying to write a query to capture all the records from the table
HistoricalEvents_URLS that are not null for the field
HistoricalEvents_Urls.articlerating. I also want to pull any matching
records from the MasterSocietalData. Is what I wrote below correct?



Select A.*,B.ArticleRating From MasterSocietalData as A Right Join
HistoricalEvents_URLS as B On A.Item = B.DocItemID and B.EventID
=:HistoricalEventID and B.ArticleRating is not null

  #2  
Old 31st January 2004, 10:41 PM
Per Larsen
 
Posts: n/a
Default Re: Right Join with a not null


"Mark Clark" <mcmahling@mac.com> wrote in message news:401b1dba@wic040d....
> I am trying to write a query to capture all the records from the table
> HistoricalEvents_URLS that are not null for the field
> HistoricalEvents_Urls.articlerating. I also want to pull any matching
> records from the MasterSocietalData. Is what I wrote below correct?
>
>
>
> Select A.*,B.ArticleRating From MasterSocietalData as A Right Join
> HistoricalEvents_URLS as B On A.Item = B.DocItemID and B.EventID
> =:HistoricalEventID and B.ArticleRating is not null


No, not quite. A right join here means show data from all rows in
HistoricalEvents_URLS but show only data from the MasterSocietalData rows,
which have a match in HistoricalEvents_URLS - based on the join condition. I
think what you want is something like this:

Select A.*, B.ArticleRating
From MasterSocietalData as A
Left Join
HistoricalEvents_URLS as B
On A.Item = B.DocItemID
Where
B.EventID = :HistoricalEventID
and B.ArticleRating is not null;

IHTH

- Per





Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ann: Join our Facebook fan group :) Eivind Bakkestuen [NDD] nexusdb.public.announcements 0 6th May 2010 11:51 PM
Left join Paul Evers nexusdb.public.support.sql 3 19th November 2003 01:18 AM
Left Outer join with 3 table? David Charron nexusdb.public.support.sql 2 8th November 2003 03:30 AM
Error with more than 1 LEFT JOIN G Lund nexusdb.public.support.sql 19 6th November 2003 08:57 PM
problem porting an outer join from Access --> Nexus Lauchlan M nexusdb.public.support.sql 20 17th October 2003 03:00 AM


All times are GMT +11. The time now is 06:27 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.