你用的时什么编程工具呢,如果是DELPHI的话,好像是用:
   ComputeDataSet := ReturnDataSet.NextRecordDataSet.
我忘记了,你试度吧。

解决方案 »

  1.   

    不知asp可不可以得到呢?
    例如:
    select * from customers where userID like 'm%' compute count(hits),sum(logontimes)
      

  2.   

    如果是ASP的话,
    也应该会有的,因为它也是用ADO的RecordDataSet
      

  3.   

    另外,这样的执行速度和
    select * from customers where userID like 'm%' 
    select count(userid),sum(logontimes) from customers where userID like '[0-9]%'
    分开写有没有不同
      

  4.   

    joioy(黑子) 兄的意思是否:
    sql="select * from customers where userID like 'm%' compute count(userid)"
    rs.open sql,conn,1,1
    ReturnDataSet.NextRecordset
    rs1.open sql,conn,1,1
    还要用另外一个记录集来取吗?
      

  5.   

    在Delphi中是这样,不过我觉得可以用Group By 来写这个SQL嘛。
      

  6.   

    select count(*) from customers where userID like 'm%' 
    group by userid
      

  7.   

    我在对数据进行分析的时候
    有很多列要进行sum(),avg(),max(),min()
    不知用group by是否可以完全代替compute?
    另外compute似乎不能用类似count(userid) as userid_count吧
    那么比如
    rs1("userid_count")不知应该怎么写?
      

  8.   

    你可以多查查帮助。
    Group by 和 compute by 是互坼的。
      

  9.   

    谢谢joioy(黑子) ,看来改用group by 或 Analysis Services
    不过既然已经到了这里,希望能将问题搞清楚吧。compute似乎不能用类似count(userid) as userid_count吧
    那么比如
    rs1("userid_count")不知应该怎么写?
      

  10.   

    今天刚学的,Select ...Order by [a,b,c...] Compute By [a,b,c...] 的用法,由于执行后会得到多记录集,所以涉及到取记录集的问题,这里要用到ado中的NextRecordSet方法。NextRecordset 方法范例
    该范例使用 NextRecordset 方法,查看使用了由三个独立 SELECT 语句组成的复合命令语句的记录集中的数据。Public Sub NextRecordsetX()   Dim rstCompound As ADODB.Recordset
       Dim strCnn As String
       Dim intCount As Integer   ' 打开复合记录集。
          strCnn = "Provider=sqloledb;" & _
          "Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
       
       Set rstCompound = New ADODB.Recordset
       rstCompound.Open "SELECT * FROM authors; " & _
          "SELECT * FROM stores; " & _
          "SELECT * FROM jobs", strCnn, , , adCmdText   ' 显示每一个 SELECT 语句的结果。
       intCount = 1
       Do Until rstCompound Is Nothing
          Debug.Print "Contents of recordset #" & intCount
          Do While Not rstCompound.EOF
             Debug.Print , rstCompound.Fields(0), _
                rstCompound.Fields(1)
             rstCompound.MoveNext
          Loop
       
          Set rstCompound = rstCompound.NextRecordset
          intCount = intCount + 1
       Loop
       
    End Sub