当前位置:网站首页>MySql实现两个查询结果相除
MySql实现两个查询结果相除
2022-06-30 12:03:00 【全栈程序员站长】
如图,最近在测试报表统计的时候,需要测试客单价,我需要先统计出商品的总额,然后再统计商品的订单总订单量,再将他们的数据相除
客单价 = 订单总额 / 订单总量
MYSQL计算公式
例如:
sql1=select sum(a) from xx;
sql2=select sum(b) from xx;
select
(select sum(a) from xx)
/
(select sum(b) from xx)
Select sum(a) / sum(b)
From XX发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/100680.html原文链接:https://javaforall.cn
边栏推荐
- Introduction to sub source code updating: mid May: uniques NFT module and nomination pool
- 视频按每100帧存一个文件夹,处理完再图片转视频
- A new journey of the smart court, paperless office, escorting the green trial of the smart court
- Browser plays RTSP video based on nodejs
- Redis6 learning notes - Chapter 2 - Basic redis6 operations
- 腾讯二面:@Bean 与 @Component 用在同一个类上,会怎么样?
- 药店管理系统
- A high precision positioning approach for category support components with multiscale difference reading notes
- Instructions for legend use in SuperMap iclient3d 11i for cesium 3D scene
- 解决服务器重装无法通过ssh连接的问题
猜你喜欢
随机推荐
Remove invalid parentheses [simulate stack with array]
What are the applications of 3D visual inspection in production flow
8253计数器介绍
Ensemble de cartes
AGCO AI frontier promotion (6.30)
Set set
90.(cesium篇)cesium高度监听事件
Construction de la plate - forme universelle haisi 3559: obtenir le codage après modification du cadre de données
【BUG解决】fiftyone报AttributeError: module ‘cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipeline‘错误解决方法
3D视觉检测在生产流水的应用有哪些
Introduction to the pursuit of new subtrate source code - early May: xcm officially launched
视频按每100帧存一个文件夹,处理完再图片转视频
The website with id 0 that was requested wasn‘t found. Verify the website and try again
杂文:自家的智能家居方案研究
Redis installation on Linux system
What is the principle of spectral confocal displacement sensor? Which fields can be applied?
Pharmacy management system
海思3559开发常识储备:相关名词全解
海思3559 sample解析:venc
SuperMap iclient3d for webgl loading TMS tiles









