如何解决错误:消息8127,级别16,状态1,行1列“CustomerloanOCR.FILELOGID”在ORDER BY子句中无效,因为它不包含在聚合函数或... [英] How to Solve Error: Msg 8127, Level 16, State 1, Line 1 Column "CustomerloanOCR.FILELOGID" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the...

查看:147
本文介绍了如何解决错误:消息8127,级别16,状态1,行1列“CustomerloanOCR.FILELOGID”在ORDER BY子句中无效,因为它不包含在聚合函数或...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HEllo团队,



我在SQL中收到错误如下。



Msg 8127 ,级别16,状态1,行1

列CustomerloanOCR.FILELOGID在ORDER BY子句中无效,因为它不包含在聚合函数或GROUP BY子句中。



我有以下查询:

HEllo Team,

I am getting the Error As follows in SQL.

Msg 8127, Level 16, State 1, Line 1
Column "CustomerloanOCR.FILELOGID" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.

I have the Query as Follows:

select count(ID) as Count from CustomerloanOCR with (nolock) where  filelogid  =
(select top (1) filelogid from customerloanocr with (nolock) where assignedto = 1
AND createdon >='2014-01-01 00:00:00'  and createdon<='2014-04-04 00:00:00' and processed = 0 and isnull(deleted,0) = 0 order by id asc )
 and processed = 0 and assignedto = 1  AND isnull(DELETED,0) = 0  Order by FILELOGID, RECORDNO





请指导我,我在哪里弄错了。



谢谢

Harshal Raut。



Kindly guide me ,where I am Getting Wrong.

Thanks
Harshal Raut.

推荐答案

试试这个:

Try this:
select count(ID) as Count from
    (
        select top (1) filelogid as ID
        from customerloanocr
        with (nolock)
        where assignedto = 1
        AND createdon between '2014-01-01 00:00:00'  and '2014-04-04 00:00:00'
        and processed = 0 and isnull(deleted,0) = 0
        AND isnull(DELETED,0) = 0
        order by id asc
    ) as subTable


这篇关于如何解决错误:消息8127,级别16,状态1,行1列“CustomerloanOCR.FILELOGID”在ORDER BY子句中无效,因为它不包含在聚合函数或...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆