经常在订单查询时需要通过高级语句查询一些自定义内容,小编就在这里给大家总结一些常用的语句供大家参考!
根据提供的子语句,用:子语句1+空格+and+空格+子语句2,拼接
1、根据店铺查订单
shopid in(select shopid from g_cfg_shoplist where shopname = '店铺名')
2、根据退款状态查订单
tradeid in(select tradeid from g_trade_tradelistext where brefund in(1,2,3))
其中brefund= 1,全部退款,2部分退款,3退款已处理
3、根据订单日志查订单(万能公式)
tradeid in (select tradeid from g_trade_log where operator = '操作人' and LogDetail like '%日志内容%' and logtime
between '2019-07-01 0:00:00' and '2019-07-19 23:59:59' union select tradeid from g_trade_log_arc where
operator = '操作人' and LogDetail like '%日志内容%' and logtime between '2019-07-01 0:00:00' and '2019-07-19
23:59:59' )
4、根据物流方式查订单
logisticid in(select logisticid from g_cfg_logisticlist where name = '物流方式')
5、根据订单货品备注查订单
tradeid in(select tradeid from g_trade_goodslist where remark like '%订单货品摘要%' union all select tradeid
from g_trade_goodslist_arc where remark like '%订单货品摘要%')
6、根据货品档案的信息查订单
tradeid in(select a.tradeid from g_trade_goodslist a join g_goods_goodslist b on a.goodsid = b.goodsid where
b.goodsno in('货品编号') union all select a.tradeid from g_trade_goodslist_arc a join g_goods_goodslist b on
a.goodsid = b.goodsid where b.goodsno in('货品编号'))
7、根据订单信息查订单
bstockout = 1 (订单是否出库,其中 1 已出库 0 未出库)
bSplitOrMerge = 1 (订单拆分标记,其中 0 正常 1 拆分 2 合并 3 合并又拆分)
tradestatus = 2 (订单状态:其中 0被取消 1等待单 2待审核 3预订单 4待结算 5打单出库 6生产等待 7待发货 8发货在途 9代销发货 10委外发货 11已完成 12报关发货 13波次配货)
8、操作人字段
seller : 业务员 、RegOperator :登记人、ConfirmOperator : 审核人、ChargeOperator :财审人、Picker :配货员、ChkOperator :出库验货人、PackageOperator :打包人、SndOperator :发货人、Printer :打单人
9、根据仓库名字查询订单
warehouseid in(select warehouseid from g_cfg_warehouselist where warehousename in( '仓库名'))
共有条评论 网友评论