title: MySQL using aliases failed
body: <p>There are 3 tables.</p>
  <ul>
  <li><code>user_groups</code> - List of user grousp (admin, user, ...)</li>
  <li><code>permissions</code> - List of permissions when using the system, e.g. &quot;access_user_management&quot;</li>
  <li><code>user_group_permissions</code> - Assignment of user groups to permissions. For example, the group &quot;admin&quot; has the permissions &quot;access_system&quot;, &quot;access_user_management&quot;, &quot;reset_system&quot; while the group &quot;user&quot; has only the permission &quot;access_system&quot;.</li>
  </ul>
  <p>Now I want to join the three tables to get the list of permissions depending on the user group ID.</p>
  <pre><code>SELECT user_groups.user_group_id, user_group_permissions.permission_id, user_groups.name, permissions.name
  FROM user_groups 
  INNER JOIN user_group_permissions 
      ON user_groups.user_group_id = user_group_permissions.user_group_id
  INNER JOIN permissions
      ON user_group_permissions.permission_id = permissions.permission_id
  WHERE user_groups.user_group_id = 1
  ORDER BY user_groups.user_group_id
  </code></pre>
  <p>My query is working well, but I want to use aliases for simplifying. Unfortunately aliases do not work.</p>
  <pre><code>SELECT user_groups.user_group_id, user_group_permissions.permission_id, user_groups.name, permissions.name
  FROM user_groups ug
  INNER JOIN user_group_permissions ugp
      ON ug.user_group_id = ugp.user_group_id
  INNER JOIN permissions per
      ON ugp.permission_id = per.permission_id
  WHERE ug.user_group_id = 2
  ORDER BY ug.user_group_id
  </code></pre>
  <p>But then the following error is thrown:</p>
  <p><strong>Error Code: 1054. Unknown column 'user_groups.user_group_id' in 'field list'.</strong></p>
  <p>Its the very same syntax for aliases that I saw in tutorials. Also tried it with <code>as</code> but this is also not working.</p>
  <p>Anyone an idea why the aliases do not work?
  I am using MySQL community server 8.0.28.</p>