select sum(price),count(id) from order ;

查询得到price列的和,以及记录数。

该SQL中sum(price)是求列price的总和,

count(id)是根据查询到的ID数量得到的数据总行数。

count(id)要比count(*)查询速度更快更节约资源

相关文章:

  • 2022-01-18
  • 2021-06-28
  • 2021-11-15
  • 2022-01-31
  • 2021-06-15
  • 2021-05-18
  • 2021-12-04
  • 2021-10-05
猜你喜欢
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
相关资源
相似解决方案