zoukankan      html  css  js  c++  java
  • GROUP BY 与count(*) 连用的时候出现问题,读不到数据

    GROUP BY 与count(*) 连用的时候出现问题,读不到数据,后来看网上网友的例子,修改如下:

    select COUNT(*) from (
    SELECT 
    MAX(proSaleBillID) as proSaleBillID,
     proSaleBill.proSaleBillCode,
     proSaleBill.BusiName,
    AVG(totalPrice) AS totalPrice ,
    MAX(receiptBill.realReciAmount) AS realReciAmount ,
    MAX(proSaleBill.totalPrice-receiptBill.realReciAmount)  as remainAmount 
    from proSaleBill ,  receiptBill
    where proSaleBill.BusiName LIKE  '%2%'  
          and  prosalebill.prosalebillcode=receiptbill.prosalebillcode
          and receiptbill.realreciamount<prosalebill.totalprice
          group by  proSaleBill.proSaleBillCode,BusiName
    ) as countt

    即把要查找数目的数据源放在select count(*)的子句里面。

    但是为什么我开始GROUP BY 与count(*) 连用的时候出现问题,读不到数据,这个不大清楚,请哪位大侠知道的给解释一下,不胜感激

  • 相关阅读:
    第二周编程总结
    介绍自己
    编程总结3
    PTA编程总
    PTA编程总结1
    《秋季学期学习总结》
    《人生路上对我影响最大的三位老师》
    介绍自己
    7-1 打印沙漏
    记叙在人生路上对你影响最大的三位老师
  • 原文地址:https://www.cnblogs.com/jinianjun/p/2551397.html
Copyright © 2011-2022 走看看