SQL Joins Help
-
Hi All, If I have two tables both with a varchar(50) field called Name how do i get just James2 to return? Table 1 has one record 'James' and Table 2 has two records 'James' & 'James2'. I've tried all the JOINS but I just cannot get this to work: SELECT dbo.Table_2.Name FROM dbo.Table_2 RIGHT JOIN dbo.Table_1 ON dbo.Table_1.Name = dbo.Table_2.Name I'm such a SQL Dunce!! Help! Cheers,
Jammer My Blog | Articles | DMon | SampleSort
-
Hi All, If I have two tables both with a varchar(50) field called Name how do i get just James2 to return? Table 1 has one record 'James' and Table 2 has two records 'James' & 'James2'. I've tried all the JOINS but I just cannot get this to work: SELECT dbo.Table_2.Name FROM dbo.Table_2 RIGHT JOIN dbo.Table_1 ON dbo.Table_1.Name = dbo.Table_2.Name I'm such a SQL Dunce!! Help! Cheers,
Jammer My Blog | Articles | DMon | SampleSort
-
Hi All, If I have two tables both with a varchar(50) field called Name how do i get just James2 to return? Table 1 has one record 'James' and Table 2 has two records 'James' & 'James2'. I've tried all the JOINS but I just cannot get this to work: SELECT dbo.Table_2.Name FROM dbo.Table_2 RIGHT JOIN dbo.Table_1 ON dbo.Table_1.Name = dbo.Table_2.Name I'm such a SQL Dunce!! Help! Cheers,
Jammer My Blog | Articles | DMon | SampleSort
Do a left join on the name and filter where table2.name is null
Select *
From Table1 T
Left Join Table2 T2 on T.Name = T2.Name
Where T2.Name is NULLNever underestimate the power of human stupidity RAH
-
Do a left join on the name and filter where table2.name is null
Select *
From Table1 T
Left Join Table2 T2 on T.Name = T2.Name
Where T2.Name is NULLNever underestimate the power of human stupidity RAH