我想将以下两个查询合并为一个查询我正在使用MySQL和Json_Extract_scalar检索json对象数据

问题描述

查询1:

select 
 distinct ifnull(concat(UPPER(JSON_EXTRACT_SCALAR(Profiles.DATA,'$.firstName')),' ',upper(JSON_EXTRACT_SCALAR(Profiles.DATA,'$.lastName'))),"-")  AS vendorName,ifnull(UPPER(JSON_EXTRACT_SCALAR(Product.DATA,'$.category')),"-") as productCategory
        from
        `roque-prod.profiles.profiles_raw_latest` as Profiles,`roque-prod.roqueprod.roque_raw_latest` as Product
        where
        Profiles.document_id = JSON_EXTRACT_SCALAR(Product.Data,'$.author')

查询2:

select 
 distinct ifnull(concat(UPPER(JSON_EXTRACT_SCALAR(Profiles.DATA,ifnull(UPPER(JSON_EXTRACT_SCALAR(Services.DATA,"-") as ServicesCategory
                    from
                    `roque-prod.profiles.profiles_raw_latest` as Profiles,services.services_raw_latest as Services
                    where
                    Profiles.document_id = JSON_EXTRACT_SCALAR(Services.Data,'$.author')

加入后,我想得到3列, 1)供应商名称 2)产品类别 3)服务类别 按供应商名称分组。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)