您好,欢迎来到五一七教育网。
搜索
您的当前位置:首页python中sql语句例题_python中的 sql语句用法

python中sql语句例题_python中的 sql语句用法

来源:五一七教育网

函数中另外一种写法cr.execute

cr.execute('''select ref_line_id,nolqty from( select ref_line_id,sum(COALESCE(case when t0.location_id=get_warehouse_id('成仓') then product_qty when t0.location_id=get_warehouse_id('原仓') then product_qty else -1*product_qty end,0) ) dlvqty from

stock_ynum t0 left join stock_fah t1 on t0.picking_id=t1.id

where t0.state='done' and ((t0.location_id=get_warehouse_id('成仓') and t0.location_dest_id=get_warehouse_id('Customers')) or (t0.location_id=get_warehouse_id('Customers')

and t0.location_dest_id=get_warehouse_id('成仓')))

or ((t0.location_id=get_warehouse_id('原仓')

and t0.location_dest_id=get_warehouse_id('Customers')) or (t0.location_id=get_warehouse_id('Customers') and t0.location_dest_id=get_warehouse_id('原仓')))

group by t0.product_id,ref_num,ref_line_id)t where ref_line_id in %s''',(tuple(ids),))

jhqty= dict(cr.fetchall())

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 517ttc.cn 版权所有 赣ICP备2024042791号-8

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务