本文介绍了如何在从表中选择所有列时使用group by子句与一列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表有三列名为OrderId,Seller,Date的表。我想使用逐个卖家从表中获取数据,但只有当我将查询写为
I have a table having three columns named OrderId,Seller,Date. I want to fetch data from table using group by seller but it works only when i write query as
select seller from tablename where OrderId=6 Group By Seller
但它我写查询时出错如下:
but it gives error when i write query as follows
select *from tablename when<big></big> OrderId=6 Group By Seller
错误:tablename.OrderId'在选择列表中无效,因为它不包含在聚合函数或GROUP BY子句中
如何解决它。是否有任何其他方法来获取数据而不重复相同的行
Error: tablename.OrderId' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
How to resolve it. Is there any other way to fetch data without repeatation of same row
推荐答案
这篇关于如何在从表中选择所有列时使用group by子句与一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!