sql="select a.*,b.*,count(distinct b.typeid) from Classtable a inner join Product b on a.typeid=b.typeid where a.sortid="&sortid&" group by b.typeid"
这句话为什么会显示不出结果?
...全文
926打赏收藏
高分请教distinct的用法?
sql="select a.*,b.*,count(distinct b.typeid) from Classtable a inner join Product b on a.typeid=b.typeid where a.sortid="&sortid&" group by b.typeid" 这句话为什么会显示不出结果?
[Quote=引用 2 楼 junshanhudazhaxi 的回复:]
这条sql语句有语法错误,group by select里的列必须包含在聚合函数中或者group by 的子句中
[/Quote]
写错了改正:
这条sql语句有语法错误,select里的列(b.*,a.*)必须包含在聚合函数中或者group by 的子句中