-- 查询order表 属于b2c的订单
SELECT t1.user_id,t1.order_id,t1.created_at,t2.name,t2.id ,t3.id,t4.id,t5.id
from codec.tbl_der t1
LEFT JOIN codec.package t2 ON t1.packagid = t2.id
LEFT JOIN edu_asics.tbl_b2c_user t3 ON t3.user_id =t1.user_id AND t3.status=3
LEFT JOIN edu_sics.tbl_b2c_reservion_user t4 ON t4.user_id =t1.user_id
LEFT JOIN edu_asics.tbl_b2c_regist_user t5 ON t5.user_id =t1.user_id
where
t1.created_at>="2021-08-01 00:00:00" AND t1.created_at<="2021-08-31 23:59:59"
相关文章
- 12-06左联右联接 给要联的表加判断条件