select title,count(*) as c,defaultpicurl from PE_article where articleid>=122580 and articleid<=123583 and deleted<>-2 group by title having count(*)>1 
Microsoft OLE DB Provider for SQL Server 错误 '80040e14' 列 'PE_article.DefaultPicUrl' 在选择列表中无效,因为该列既不包含在聚合函数中,也不包含在 GROUP BY 子句中。 这个要怎么改,,group by 中不想使用defaultpicurl
但想能读出defaultpicurl这个字段的值。

解决方案 »

  1.   

    这个要怎么改,,group by 中不想使用defaultpicurl
    但想能读出defaultpicurl这个字段的值。
    ============这怎么可能?
      

  2.   

    rs.open "select title,count(*) as c from PE_article where articleid>=122580 and articleid<=123583 and deleted<>-2 group by title having count(*)>1",conn,1,1
     
    这是读取title字段有重复的记录。
    现在我读取记录能实现用rs("title")取得这个字段的值的同时。
    也能用rs("aabc")读取另一个字段的值?这样不能实现吗?
      

  3.   

    不能,如果外加一个字段的话,就必须按这个字段
    group by .
      

  4.   

    举个例子:
    Title    defaultpicurl 
    A        11
    A        22如果只按TITLE group by ,又要显示 defaultpicurl 它是显示  11呢还是显示22 ?
      

  5.   

    group by 子句中指定的列必须包含在选择列表中
      

  6.   

    select title,count(*) as c,max(defaultpicurl) as defaultpicurl from PE_article where articleid>=122580 and articleid<=123583 and deleted<>-2 group by title having count(*)>1
      

  7.   

    select title,defaultpicurl ,count(*) as c from PE_article where articleid>=122580 and articleid<=123583 and deleted<>-2 group by title having count(*)>1 order by title,defaultpicurl
      

  8.   

    没办法,要不用聚合,要不在group by里,要不就不要用楼主想下就知道实现不了
    如果3条title相同的记录,而defaultpicurl不同,最终group by出一条记录,那这条记录的defaultpicurl值应该取哪个呢?