I have selected two record groups (217,244) and want to perform a query that will list all the records, whether matching or not. What am I doing wrong? I cannot get recid=4 to show in the result set.
Create Table ImportLog ( recid int, grouploadid int, groupid int, tablename varchar(128), note varchar(500) ) Insert Into ImportLog Values (1,216,1,'tableb','noteb'), (2,217,1,'tablea','notea'), (3,217,2,'tableb','noteb'), (4,217,3,'tabled','noted'), (5,230,1,'tableb','noteb'), (6,244,1,'tablea','notea'), (7,244,2,'tableb','noteb'), (8,244,3,'tablec','notec') select r1.RecID, r1.GroupLoadID, r1.groupid, r1.tablename, r1.note, r2.RecID, r2.GroupLoadID, r2.groupid, r2.tablename, r2.note from ImportLog r1 --left outer join -- shows record 8 -- right outer join -- will not show record 4 full join -- shows record 8, will not show record 4 (select RecID, GroupLoadID, groupid, tablename, note from ImportLog where GroupLoadID = '217' ) r2 on r1.TableName = r2.TableName and r1.Note = r2.Note and r1.Groupid = r2.Groupid where r1.GroupLoadID = '244' order by 1