SELECT MAX(R.Stage),D.CarID,D.RecordID FROM Repayinfo as R,CustomerBaseInfo as C,CustomerCarInfo as D where R.RecordID=C.RecordID and C.Address like '%城区%' and R.RepayKind='CarLoan' GROUP BY D.CarID ORDER BY D.CarID不好意思,看一下线在这一句,在查询分析器中出现下面错误提示服务器: 消息 8120,级别 16,状态 1,行 1
列 'D.RecordID' 在选择列表中无效,因为该列既不包含在聚合函数中,也不包含在 GROUP BY 子句中。
列 'D.RecordID' 在选择列表中无效,因为该列既不包含在聚合函数中,也不包含在 GROUP BY 子句中。
解决方案 »
- 我要疯了,谁能建立一个存储过程,完成两台服务器中大容量数据表的复制
- sql server中如何添加新的一列,而这一列中的值是前两列的乘积?
- 关于replace的问题:如何在整张表里替换/删除多个特殊字符
- 求助sql2005新建database问题
- 如何用SELECT进行合并查询?
- 请教数据如何剥离?
- 这个SQL怎么写
- +++++修改MS-SQL Server 2000客户端最大客户端连接数???+++++
- 如何实现从多个表中查询,并把结果放在一个记录集中(adodb.recordset)
- 如何用powerdesigner8生成测试数据?
- 谁能总结一下ADO.NET里连接SQLSERVER的语句!谢谢
- 在线等待,搞定立即结贴,50!!
FROM Repayinfo as R,CustomerBaseInfo as C,CustomerCarInfo as D
where R.RecordID=C.RecordID and C.Address like '%城区%' and R.RepayKind='CarLoan'
GROUP BY D.CarID
ORDER BY D.CarID--没问题啊,你仔细看看表结构
GROUP BY D.CarID ,D.RecordID --notice
ORDER BY D.CarID
FROM Repayinfo as R,CustomerBaseInfo as C,CustomerCarInfo as D
where R.RecordID=C.RecordID and C.Address like '%城区%' and R.RepayKind='CarLoan'
GROUP BY D.CarID
ORDER BY D.CarID或
SELECT MAX(R.Stage),D.CarID,D.RecordID
FROM Repayinfo as R,CustomerBaseInfo as C,CustomerCarInfo as D
where R.RecordID=C.RecordID and C.Address like '%城区%' and R.RepayKind='CarLoan'
GROUP BY D.CarID ,D.RecordID --加到group by 中
ORDER BY D.CarID