title: Sql: Using alias in nested queries
body: <pre><code>select
      user.name,
      (select department.name
       from profile, degree, department
       where user.profile_id=profile.id
       and profile.degree_id=degree.id
       and degree.department_id=department.id) DEPT_NAME
  from user, query
  where user.id=query.user_id as USER_NAME
  order by user.name;
  </code></pre>
  
  <p>This is the query I have written.In this for department.name the column alias changed to DEPT_NAME but for user.name it doesn't changes, it throws error.. Please help...</p>