Alias not working in query
<p>I need to display the name of the user and their department who has raised the maximum number of queries. I wrote the following query by joining 5 tables; <code>user</code>, <code>query</code>, <code>profile</code>, <code>degree</code>, and <code>department</code>.</p>

<p>The problem is in the result the alias is not being used for the column names. For both the columns it appears as just <code>name</code></p>

<pre><code>select user.name 'USER_NAME',department.name 'DEPT_NAME'
from user
inner join query on (query.user_id=user.id)
inner join profile on (user.profile_id=profile.id)
inner join degree on (profile.degree_id=degree.id)
inner join department on (degree.department_id=department.id)
group by user.name
order by count(query.id) desc
limit  1
</code></pre>