当前位置:网站首页>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
边栏推荐
- Essay: Research on smart home scheme
- SuperMap iServer11i新功能----图例的发布和使用
- Parallel interface 8255A
- 光谱共焦位移传感器的原理是什么?能应用那些领域?
- Linux系统Redis的安装
- MySQL composite query
- A high precision positioning approach for category support components with multiscale difference reading notes
- Layout of pyqt5 interface and loading of resource files
- DMA controller 8237a
- Building a database model using power designer tools
猜你喜欢

Redis的基本操作的命令

Introduction to new features of ES6

Understanding and learning of MySQL indexing and optimization

STM32 porting the fish component of RT thread Standard Edition

【目标跟踪】|pytracking 配置 win 编译prroi_pool.pyd

Pinda general permission system (day 7~day 8)

SuperMap 3D SDKs_Unity插件开发——连接数据服务进行SQL查询

How to detect 3D line spectral confocal sensors in semiconductors

Hannaiping of Qilin software: the construction of Digital China needs its own open source root community

Hisilicon 3559 developing common sense reserves: a complete explanation of related terms
随机推荐
pyqt5界面的布局与资源文件的载入
The website with id 0 that was requested wasn‘t found. Verify the website and try again
Clipboardjs - development learning summary 1
Edusoho enterprise training version intranet only deployment tutorial (to solve the problems of player, upload and background jam)
杂文:自家的智能家居方案研究
Iserver publishing es service query setting maximum return quantity
Swagger2自动生成APi文档
Mysql中 begin..end使用遇到的坑
Map collection
会议预告 | 华为 2012 实验室全球软件技术峰会-欧洲分会场
Introduction to new features of ES6
Redis的基本操作的命令
QT MSVC installation and commissioning
A high precision positioning approach for category support components with multiscale difference reading notes
Hannaiping of Qilin software: the construction of Digital China needs its own open source root community
Commands for redis basic operations
"Xiaodeng" user personal data management in operation and maintenance
Ensemble de cartes
How to use the plug-in mechanism to gracefully encapsulate your request hook
Building of Hisilicon 3559 universal platform: obtaining the modified code of data frame