Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select query

Author  Topic 

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-06-05 : 08:09:11
select min(grade)
from (select grade from l_grade g
join l_DesignationMaster d on g.DesignationId=d.DesignationId
join l_departmentmaster m on m.DepartmentId =d.DepartmentId
where d.departmentid=1 and g.grade not in (30))

what's wrong in the above select statement

Malathi Rao

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-05 : 08:16:09
Missing table alias for derived table.

select min(grade) 
from
(select grade from l_grade g
join l_DesignationMaster d on g.DesignationId=d.DesignationId
join l_departmentmaster m on m.DepartmentId =d.DepartmentId
where d.departmentid=1 and g.grade not in (30)) t



Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-09 : 07:06:51
or

select min(grade) as grade from l_grade g
join l_DesignationMaster d on g.DesignationId=d.DesignationId
join l_departmentmaster m on m.DepartmentId =d.DepartmentId
where d.departmentid=1 and g.grade not in (30)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -