title: using (not in) in inner join sql
body: <p>i have two tables</p>
  
  <blockquote>
    <p>1) tbluser 2) userlogin</p>
  </blockquote>
  
  <p>tbluser consist of </p>
  
  <blockquote>
    <p>username and email</p>
  </blockquote>
  
  <p>and userlogin looks like</p>
  
  <pre><code>create table userlogin
  (
  username varchar(50),
  [date] datetime
  )
  </code></pre>
  
  <p>i want to select email from tbluser and validate userlogin(table 2)</p>
  
  <p>i want email of the employees from table 1 which are not in table 2 with selected date range</p>
  
  <p>so i created a procedure</p>
  
  <pre><code>alter proc TMSautomail
  @datefrm datetime,
  @dateto datetime
  as
  begin
  SELECT
       tblUser.Email
  from
       tblUser
           inner join
       userlogin
           on
        tblUser.UserName not in userlogin.username
  where userlogin.date between @datefrm and @dateto
  end
  </code></pre>
  
  <p>it is showing me error,
  when i change the procedure
  to this</p>
  
  <pre><code>alter proc TMSautomail
  @datefrm datetime,
  @dateto datetime
  as
  begin
  SELECT
       tblUser.Email
  from
       tblUser
           left outer join
       userlogin
           on
        tblUser.UserName = userlogin.username
  where userlogin.date between @datefrm and @dateto and userlogin.username is null
  end
  </code></pre>
  
  <p>the procedure returns blank column,</p>
  
  <p>i want to fetch email of table one and validate with username which are not in table 2,</p>
  
  <p>my second table is consist of one entry</p>
  
  <p>it should return all rows of table one</p>