I am passing the following parameters to my stored procedure @username, @password, @source.
My select statement looks something like this
Select *
From Table1 LEFT OUTER JOIN Table2 ON Table1.name = Table2.winname
Where @username = table1.name and @password = table1.password And table2.source = @source
Example
Table1 Table2
name winname
username accessarea
password source
What I am trying to do is return all rows from table1, even if there is no source in table2, but if there is a source return only those records that match my parameter I pass.
I thought with Left Outer Join my select would return all rows from table 1 and if no matchin rows in table2 then return a null value for those columns. It works fine if I take out (where source = @source). Does anyone know if this is even possible, without returning the information in a temp table???? Thanks in advance for any help.
My select statement looks something like this
Select *
From Table1 LEFT OUTER JOIN Table2 ON Table1.name = Table2.winname
Where @username = table1.name and @password = table1.password And table2.source = @source
Example
Table1 Table2
name winname
username accessarea
password source
What I am trying to do is return all rows from table1, even if there is no source in table2, but if there is a source return only those records that match my parameter I pass.
I thought with Left Outer Join my select would return all rows from table 1 and if no matchin rows in table2 then return a null value for those columns. It works fine if I take out (where source = @source). Does anyone know if this is even possible, without returning the information in a temp table???? Thanks in advance for any help.