title: SQL to retrieve username and password from 3 tables
body: <p>I have to retrieve username and password from 3 SQL Server tables (user1, user2, admin, with username and password in each table) with no foreign keys.</p>
  
  <pre><code>SqlCommand cmd = new SqlCommand("select * from user1 UNION select * from user2 
  union select * from admin where username = @username and password = @password", con);
  </code></pre>
  
  <p>I get an error which says:</p>
  
  <blockquote>
    <p>All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists</p>
  </blockquote>