时间:2021-07-01 10:21:17 帮助过:2人阅读
UPDATE shopnc_goods_common SET goods_body = INSERT(goods_body, INSTR(goods_body,‘<div class="p_titles_2">商品特色</div>‘), INSTR(goods_body,‘<div class="p_titles_2">商品参数</div>‘)- INSTR(goods_body,‘<div class="p_titles_2">商品特色</div>‘),‘‘) WHERE gc_id_2 in (294,284,289,261,216) and goods_body LIKE ‘%商品特色%‘
SELECT shopnc_cps.order_sn as 订单号,shopnc_orders.buyer_name as 用户名,FROM_UNIXTIME(shopnc_orders.add_time,‘%Y-%m-%d %H:%i:%S‘) as 下单时间, shopnc_order_goods.goods_name as 商品名称,shopnc_orders.store_name as 店铺名,shopnc_orders.CustomerNo as 用户编号, CASE WHEN shopnc_orders.order_state = ‘0‘ THEN ‘以取消‘ WHEN shopnc_orders.order_state = ‘10‘ THEN ‘未付款‘ WHEN shopnc_orders.order_state = ‘20‘ THEN ‘以付款‘ WHEN shopnc_orders.order_state = ‘30‘ THEN ‘以发货‘ WHEN shopnc_orders.order_state = ‘40‘ THEN ‘以收货‘ END AS 订单状态, CASE WHEN shopnc_goods.gc_id_1 = ‘1‘ THEN ‘汽车精品‘ WHEN shopnc_goods.gc_id_1 = ‘15‘ THEN ‘服装鞋帽‘ WHEN shopnc_goods.gc_id_1 = ‘53‘ THEN ‘箱包配饰‘ WHEN shopnc_goods.gc_id_1 = ‘77‘ THEN ‘数码家电‘ WHEN shopnc_goods.gc_id_1 = ‘124‘ THEN ‘个护彩妆‘ WHEN shopnc_goods.gc_id_1 = ‘159‘ THEN ‘家居日用‘ WHEN shopnc_goods.gc_id_1 = ‘215‘ THEN ‘珠宝收藏‘ WHEN shopnc_goods.gc_id_1 = ‘264‘ THEN ‘食品保健‘ WHEN shopnc_goods.gc_id_1 = ‘302‘ THEN ‘旅游度假‘ WHEN shopnc_goods.gc_id_1 = ‘313‘ THEN ‘母婴玩具‘ WHEN shopnc_goods.gc_id_1 = ‘319‘ THEN ‘燕京八绝‘ WHEN shopnc_goods.gc_id_1 = ‘354‘ THEN ‘手机充值‘ WHEN shopnc_goods.gc_id_1 = ‘355‘ THEN ‘其他分类‘ END as 商品分类, CASE WHEN shopnc_orders.payment_code = ‘offline‘ THEN ‘货到付款‘ WHEN shopnc_orders.payment_code = ‘online‘ THEN ‘在线支付‘ WHEN shopnc_orders.payment_code = ‘wxpay‘ THEN ‘微信支付‘ WHEN shopnc_orders.payment_code = ‘alipay‘ THEN ‘支付宝‘ WHEN shopnc_orders.payment_code = ‘unionpay‘ THEN ‘银联‘ WHEN shopnc_orders.payment_code = ‘pingan‘ THEN ‘平安银行‘ ELSE ‘不知道什么支付方式‘ END as 支付方式,shopnc_order_goods.goods_id as 商品ID,shopnc_order_goods.goods_price as 商品价格,shopnc_order_goods.goods_pay_price as 订单支付价格, shopnc_order_goods.goods_num as 商品数量,shopnc_order_goods.unit_code as 德珍商品编号,shopnc_order_goods.goods_usevipdiscount as 会员折扣,shopnc_order_goods.goods_usediscount as 代金券, shopnc_order_goods.goods_useuserpoint as 使用购物金,shopnc_order_goods.goods_freight as 运费,shopnc_order_goods.living_goods_discount as 正在直播商品优惠,shopnc_order_goods.yihe_cuxiao as 移动端货到付款优惠, shopnc_order_goods.gc_id as 商品分类 , CASE WHEN shopnc_goods.gc_id_1 IN (15,53,124,159,264) AND shopnc_goods.goods_promotion_type =0 THEN ‘5%‘ WHEN shopnc_goods.gc_id_1 IN (15,53,124,159,264) AND shopnc_goods.goods_promotion_type != 0 THEN ‘3%‘ WHEN shopnc_goods.gc_id_1 IN (215,302) THEN ‘3%‘ WHEN shopnc_goods.gc_id_1 = ‘77‘ AND shopnc_goods.gc_id_2 != ‘110‘ THEN ‘3%‘ ELSE ‘0%‘ END as 佣金比例 , (CASE WHEN shopnc_goods.gc_id_1 IN (15,53,124,159,264) AND shopnc_goods.goods_promotion_type =0 THEN 0.05 WHEN shopnc_goods.gc_id_1 IN (15,53,124,159,264) AND shopnc_goods.goods_promotion_type != 0 THEN 0.03 WHEN shopnc_goods.gc_id_1 IN (215,302) THEN 0.03 WHEN shopnc_goods.gc_id_1 = ‘77‘ AND shopnc_goods.gc_id_2 != ‘110‘ THEN 0.03 ELSE 0 END)*(shopnc_order_goods.goods_pay_price - 21) AS 佣金金额,‘16‘ AS 包装费 ,‘5‘ AS 邮费 , shopnc_order_goods.rcb as 使用充值卡金额,shopnc_order_goods.pd as 使用预付款金额, CASE WHEN shopnc_cps.c_id = ‘17574‘ THEN ‘汽车精品‘ WHEN shopnc_cps.c_id = ‘18000‘ THEN ‘领克特‘ WHEN shopnc_cps.c_id = ‘19000‘ THEN ‘唯一传媒‘ END as cps来源, CASE WHEN shopnc_orders.client = ‘1‘ THEN ‘网站‘ WHEN shopnc_orders.client = ‘2‘ THEN ‘wap‘ WHEN shopnc_orders.client = ‘3‘ THEN ‘微信‘ END as 订单来源 , shopnc_order_push.order_push_sn as 德珍订单号 FROM shopnc_cps LEFT JOIN shopnc_orders ON shopnc_cps.order_sn = shopnc_orders.order_sn LEFT JOIN shopnc_order_goods ON shopnc_orders.order_id = shopnc_order_goods.order_id LEFT JOIN shopnc_goods ON shopnc_order_goods.goods_id =shopnc_goods.goods_id LEFT JOIN shopnc_order_push ON shopnc_orders.order_sn = shopnc_order_push.order_sn WHERE shopnc_orders.add_time >= ‘1435680000‘ and shopnc_orders.add_time <= ‘1438358400‘
最后一个有点复杂
一些稍微复杂点的sql语句
标签: