自己写的版本:
db.session.query(Small_Device_cnm_Bandwidth.bandwidth,Small_Device_cntcnc_Bandwidth.bandwidth,(Small_Device_cntcnc_Bandwidth.bandwidth + Small_Device_cnm_Bandwidth.bandwidth).label('bandwith_total')).join(Small_Device_cntcnc_Bandwidth,Small_Device_cntcnc_Bandwidth.record_time==Small_Device_cnm_Bandwidth.record_time).filter(Small_Device_cntcnc_Bandwidth.create_time=='2019-11-01').order_by(Small_Device_cntcnc_Bandwidth.bandwidth.desc()).all()
简化版本:
db.session.query(a,b,(a+b).label('c')).order_by(c.desc()).all()