title: I need MYSQL query solution
body: <p>I have these tables and in one query with username and password (at login) I want to select the data from the right table.
  example: in the user table there is the field permission.
  admin has privileges 1, vendor has privileges 2, and customer has privileges 3.
  thanks. </p>
  
  <pre><code>+------------+--+----------+--+-----------+--+-------------+
  |    user    |  |  admin   |  |  vendor   |  |  customer   |
  +------------+--+----------+--+-----------+--+-------------+
  | id_user    |  | id_admin |  | id_vendor |  | id_customer |
  | username   |  | id_user  |  | id_user   |  | id_user     |
  | password   |  | name     |  | name      |  | name        |
  | permission |  | surname  |  | surname   |  | surname     |
  +------------+--+----------+--+-----------+--+-------------+
  </code></pre>