标题: 【已解决】 SQL Group By 问题 [打印本页] 作者: shinn1080 时间: 2012-8-15 01:52 PM 标题: 【已解决】 SQL Group By 问题 本帖最后由 shinn1080 于 2012-8-16 10:11 AM 编辑
各位好
select empPhoto.ImageData,upduser, count(upduser) as totalView from efview left join empPhoto on empPhoto.emp_id = efview.upduser where docid = '1' and version ='1.00' group by efview.updUser
复制代码
出现的error如下
Msg 8120, Level 16, State 1, Line 1
Column 'empPhoto.ImageData' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
select empPhoto.ImageData,upduser, count(upduser) as totalView from efview left join empPhoto on empPhoto.emp_id = efview.upduser where docid = '1' and version ='1.00' group by efview.updUser, empPhoto.ImageData