[求助]聚合函数使用的问题?
SQL语句如下:
select top 1 dbo.个人会员.个人id,dbo.个人会员.姓名
from dbo.个人会员 INNER JOIN
dbo.个人专长 ON dbo.个人会员.个人ID = dbo.个人专长.个人ID INNER JOIN
dbo.个人联系方式 ON dbo.个人会员.个人ID = dbo.个人联系方式.个人ID INNER JOIN
dbo.个人要求 ON dbo.个人会员.个人ID = dbo.个人要求.个人ID
where dbo.个人会员.个人id<(select min(dbo.个人会员.个人id)
from (select top 1 dbo.个人会员.个人id
from dbo.个人会员 INNER JOIN
dbo.个人专长 ON dbo.个人会员.个人ID = dbo.个人专长.个人ID INNER JOIN
dbo.个人联系方式 ON dbo.个人会员.个人ID = dbo.个人联系方式.个人ID INNER JOIN
dbo.个人要求 ON dbo.个人会员.个人ID = dbo.个人要求.个人ID
where dbo.个人会员.个人id>0 order by dbo.个人会员.个人id desc) as tblTmp) and dbo.个人会员.个人id>0 order by dbo.个人会员.个人id desc
提示:聚合不应出现在 WHERE 子句中,除非该聚合位于 HAVING 子句或选择列表所包含的子查询中,并且要对其进行聚合的列是外部引用