select ( select count(*) + ( select count(*) from vehicle_records where date_format( '2023-07-06 00:00:00', '%y%m%d' ) = date_format( rcsj, '%y%m%d' )) as jrsl from parking_vehicles where date_format( '2023-07-06 00:00:00', '%y%m%d' ) = date_format( rcsj, '%y%m%d' ) ) as jrsl, (select count(*) as scsl from vehicle_records where date_format('2023-07-06 00:00:00','%y%m%d') = date_format(ccsj,'%y%m%d')) as scsl from dual
时间: 2024-01-11 17:02:22 浏览: 81
你的查询语句是正确的,它从两个子查询中选择数据并计算出两个值:jrsl和scsl。
第一个子查询计算jrsl(今日数量),它首先从parking_vehicles表中选择满足日期条件的记录数量。然后,它执行一个嵌套的子查询,从vehicle_records表中选择满足日期条件的记录数量,并将其加到parking_vehicles表的记录数量上。最终,jrsl值将是parking_vehicles表和vehicle_records表中满足日期条件的记录总数。
第二个子查询计算scsl(上车数量),它从vehicle_records表中选择满足日期条件的记录数量。
最后,使用"from dual"语句将两个子查询的结果作为jrsl和scsl返回。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)