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(*) 连用的时候出现问题,读不到数据,这个不大清楚,请哪位大侠知道的给解释一下,不胜感激

相关文章:

  • 2021-08-28
  • 2021-07-13
  • 2021-09-03
  • 2021-07-20
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-22
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2021-12-01
相关资源
相似解决方案