官方题解 | #某滴出行2021年9月各城市每天的快车订单量#

某滴出行2021年9月各城市每天的快车订单量

http://www.nowcoder.com/practice/1423d82b2fcc478d9487518a445e463b

step1:使用driver_id相等条件,将order_info_tb左连接driver_tb;

step2:使用city_id相等条件,左连接city_tb;

step3:限制类型为快车,时间为9月,按city_id、日期分组统计数量即为快车订单量;

step4:按城市编号、时间排序。

select city_name, a.dt, count(distinct order_id) as flash_count

FROM order_info_tb a

LEFT JOIN driver_tb b

on a.driver_id=b.driver_id

LEFT JOIN city_tb c

on b.city_id = c.city_id

WHERE product_line_id=2 and DATE_FORMAT(a.dt, '%Y-%m')='2021-09'

GROUP BY b.city_id, a.dt

ORDER BY b.city_id, a.dt;

全部评论

相关推荐

07-02 22:46
门头沟学院 Java
码农索隆:hr:“管你投没投,先挂了再说”
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务