zoukankan      html  css  js  c++  java
  • 经典sql

    1.查询登录人是产品经理有权限查看的产品

    sql1:

    select DISTINCT a.real_product_id as realProductId,a.product_code as productCode,a.product_name as productName,
        a.product_type as productType,c.invest_direction as investDirection,a.product_managers as productManagers,
        a.product_audit as productAudit,c.income_type as incomeType,c.term,c.term_unit as termUnit,c.upper_limit as upperLimit,
        a.create_time as createTime, a.product_state as productState
        from prod_base_information a
        left join prod_product_message c on a.real_product_id = c.real_product_id
        left join prod_related_personnel d on a.real_product_id = d.real_product_id
        left join prod_related_personnel e on a.real_product_id = e.real_product_id
        left join prod_manager b on a.real_product_id = b.real_product_id
        where
        d.employee_num = 'H018494' and d.product_role = 0 and d.privileges is not null and d.privileges != '' 
        and e.employee_num = 'H011492' and e.product_role = 0 and e.privileges is not null and e.privileges != '' 

    sql2:

    select DISTINCT a.real_product_id as realProductId,a.product_code as productCode,a.product_name as productName,
        a.product_type as productType,c.invest_direction as investDirection,a.product_managers as productManagers,
        a.product_audit as productAudit,c.income_type as incomeType,c.term,c.term_unit as termUnit,c.upper_limit as upperLimit,
        a.create_time as createTime, a.product_state as productState, d.productManagers,d.employee_num
        from prod_base_information a
        left join prod_product_message c on a.real_product_id = c.real_product_id
        left join 
        (select p.real_product_id,GROUP_CONCAT(p.employee_name) productManagers,GROUP_CONCAT(p.employee_num) employee_num from prod_related_personnel p 
            where p.product_role = 0 and p.privileges is not null and p.privileges != '' 
            GROUP BY p.real_product_id
        ) d on d.real_product_id = a.real_product_id
        left join prod_manager b on a.real_product_id = b.real_product_id
        where
        d.employee_num like '%H018494%' 
        and d.employee_num like '%H011492%'
  • 相关阅读:
    在Ubuntu11.10中安装OpenCV2.3.1的详细步骤
    基于二元语法模型的中文分词
    相似图片搜索的原理
    基于GPU的KMeans聚类算法
    Windows下Eclipse和PyDev搭建完美Python开发环境
    Ubuntu 11.10+win7双系统启动项管理及配置方法
    主题爬虫
    vue定义全局过滤器
    element elimage 放多张图片,显示大图
    element UI的form 禁止浏览器自动填充用户名或密码
  • 原文地址:https://www.cnblogs.com/super-chao/p/9267588.html
Copyright © 2011-2022 走看看