title: Return data without including that data in the comparison
body: <p>I am using the below code:</p>
  
  <pre><code>SELECT l_name, f_name, user_id
  FROM (SELECT a.l_name, a.f_name, count(*)
        FROM shema.emp_table1 a, schema2.emp_table2 b
       WHERE     a.emp_id = b.emp_id2
             AND b.office_num = '4017'
             AND a.email IS NULL
      HAVING COUNT (a.l_name) &gt; 1
      group by a.l_name, a.f_name
      ORDER BY a.l_name, a.f_name)
  GROUP BY l_name, f_name;
  </code></pre>
  
  <p>...what I WANT to do is return the users Last Name, First Name AND User ID, IF the users in the database 'match up' on Last Name (potential duplicates).  Where I'm running into problems is that the USER_ID field is going to be unique for each user...so even though they may share a last and first name, the user ID is unique...and this is causing my query to return zero rows.  If I eliminate the user ID field from the search criteria, I get the list I'm looking for:  Users who share a last and first name...(for instance Doe, John with a count of 4).  But even though I don't want the query against the User ID, I DO want it as one of the 'returned fields'...but I can't seem to get it to do that.</p>
  
  <p>Any assistance would be most appreciated.  I've tried many different variations of the above query, with/without counts inside and out, with/without user_id inside and out, etc., and so far no luck in getting what I'm looking for.</p>
  
  <p>What I'd like to have as output would be something like:</p>
  
  <pre><code>L_NAME                 F_NAME                  USER_ID               COUNT(*)
  SMITH                  JOHN                    ABC123                2
  SMITH                  JOHN                    BCD234                2
  </code></pre>
  
  <p>...although, now that I'm looking for it, the query may not work because the 'count(*)' won't be 2 for Smith, John with a User ID of ABC123...the 'User ID' is causing it to be more difficult than I'd like.  Do I need to write an anomyous block to fill this kind of request?</p>
  
  <p>Thanks!</p>