title: Return common users using values from 2 temp tables?
body: <p>I need to return a list of Common Users where UserNames are checked if the have access to a few widgetIDs.</p>
  
  <p>How is this best accomplished using SQL for SQL server 2008 R2?</p>
  
  <pre><code>UserNames in #DistinctUIDs table
  admin1@co.com
  admin2@co.com
  admin3@co.com
  ent_admin1@co.com
  nonadmin1@co.com
  
  WidgetIDs in #WidgetIDs table
  765
  768
  769
  
  Function:
   ufnGetWidgetsForUser ( @UserName )
  </code></pre>
  
  <p>I made sure I only put 1 column in each temp table. I just need to run a check on the UserName to see if the Function returns any of the values in the #widgetIDs table in other words a match.</p>
  
  <p>So for example (for logics sake) a loop that checks to see admin1@co.com has access to all 3 widgets. because he needs to in order for me to reassign ownership of the widget to another User.</p>
  
  <p>Is some sort of Cross-Join needed?</p>