码迷,mamicode.com
首页 > 其他好文 > 详细

LIKE CONCAT 连用

时间:2019-07-02 10:42:11      阅读:255      评论:0      收藏:0      [点我收藏+]

标签:技术   HERE   ima   cat   ike   company   code   flag   payment   

SELECT
    (@i :=@i + 1) AS number,
    x.uuid,
    x.payment_code,
    x.supplier_name,
    x.receive_money,
    x.is_export_flag,
    x.export_time,
    x.payer,
    x.region_name,
    x.user_name,
    x.marketer_id ,
x.region_id
FROM
    (
        SELECT DISTINCT
            a.uuid,
            a.payment_code,
            a.supplier_name,
            a.receive_money,

        IF (
            is_export_flag = 0,
            未导出,
            已导出
        ) AS is_export_flag,
        a.export_time,
        b.payer,
        d.region_name,
         GROUP_CONCAT(DISTINCT f.user_name) AS user_name,
-- ( f.user_name )AS user_name,
        e.marketer_id,
d.uuid as region_id
    FROM
        biz_lc_payment_info a,
        biz_lc_payment_invoice_info b
    LEFT JOIN biz_item_company c ON b.payer = c.item_company_name
    AND c.sys_status = 1
    LEFT JOIN biz_item_region d ON c.region_id = d.uuid
    AND d.sys_status = 1
    LEFT JOIN biz_link_marketer_region e ON e.region_id = d.uuid
    AND d.sys_status = 1
    LEFT JOIN sys_user f ON e.marketer_id LIKE CONCAT(%, f.uuid, %)
    AND f.sys_status = 1
    WHERE
        a.payment_id = b.payment_id
    AND a.sys_status = 1
    AND b.sys_status = 1
    GROUP BY
        a.uuid
    ) x,
    (SELECT @i := 0) AS y
WHERE
--     x.marketer_id LIKE ‘%u1032%‘ 
 x.is_export_flag = 已导出 

技术图片

 

LIKE CONCAT 连用

标签:技术   HERE   ima   cat   ike   company   code   flag   payment   

原文地址:https://www.cnblogs.com/xiaowoniulx/p/11118996.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!