如何把三段spl语句合并一起返回数据?

发布于 2022-09-05 07:24:44 字数 1621 浏览 19 评论 0

请问如何把这三段组合在一起返回:

select count(*) from (
select
                                     a.amount as suixi_money,
                                     a.amodanaTime as suixi_tiem,
                                     a.registerMobile as principal_tel_number,
                                     b.type as activity_type,
                                     c.name as query_nickname,
                                     c.mobile as query_tel_number,
                                     c.realName as query_name
                               from tb_activity_record a
                                left join tb_activity b on a.activityId = b.id
                                left join tb_member c on a.memberId = c.id
                                
                              where 1=1
                                and b.uid = '8445e6a4-9341-455b-bfef-81e0b5ed7a1e'
                                and  (
                                c.name like '1%'
                                or c.realName like '1%'
                                or c.mobile like '1%'
                                 )
                                 ) aa
                                 
                                 
                                
                            select count(*) from (select distinct memberId from tb_activity_record ) ab
                            
                            select SUM(amount) from tb_activity_record

图片描述

谢谢!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

左耳近心 2022-09-12 07:24:44
select
    a.amount as suixi_money,
    a.amodanaTime as suixi_tiem,
    a.registerMobile as principal_tel_number,
    b.type as activity_type,
    c.`name` as query_nickname,
    c.mobile as query_tel_number,
    c.realName as query_name,
    amount.amount as allAmount,
    person.person as allPerson
from 
    tb_activity_record a
    left join tb_activity b on a.activityId = b.id
    left join tb_member c on a.memberId = c.id
    left join (SELECT SUM(amount) as amount,activityId FROM 
        `tb_activity_record` WHERE activityId = (SELECT id FROM tb_activity WHERE uid = '8445e6a4-9341-455b-bfef-81e0b5ed7a1e')) amount ON a.activityId = amount.activityId
    LEFT JOIN (select count(*) as person,activityId from 
        (select distinct(memberId),activityId from tb_activity_record WHERE activityId = (SELECT id FROM tb_activity WHERE uid = '8445e6a4-9341-455b-bfef-81e0b5ed7a1e')) ac) person ON a.activityId = person.activityId
where 
    b.uid = '8445e6a4-9341-455b-bfef-81e0b5ed7a1e'
    and (c.name like '1%' or c.realName like '1%'or c.mobile like '1%')

这个可以

早茶月光 2022-09-12 07:24:44
select (SEGMENT_A), (SEGMENT_B), (SEGMENT_C) from dual
沫离伤花 2022-09-12 07:24:44

使用union呀

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文