Re: How to complete the requirement by writing an oracle sql?

From: Sayan Malakshinov <xt.and.r_at_gmail.com>
Date: Mon, 10 Apr 2023 15:56:16 +0100
Message-ID: <CAOVevU6o=3X+RTyPd_5m6Dc1FGMOaf0Sc0yavEhRd3mZ7kKnDw_at_mail.gmail.com>



Left join & size1-nvl(size2, 0)

Best regards,
Sayan Malakshinov
Oracle performance tuning expert
Oracle Database Developer Choice Award winner Oracle ACE
http://orasql.org

On Mon, 10 Apr 2023, 15:53 Quanwen Zhao, <quanwenzhao_at_gmail.com> wrote:

> Hello there,
>
> I've a requirement about how to retrieve the final calc result from two
> number of tables (A and B) from oracle database, such as:
>
> table A:
>
> TS_NAME USED_SIZE(MB)
>> -------------- ------------------------
>> a 10
>> b 20
>> c 30
>> d 40
>> e 50
>
>
> table B:
>
> TS_NAME USES_SIZE(MB)
>> --------------- ------------------------
>> a 2
>> b 6
>> e 20
>
>
> I expect to acquire the result like this:
>
> TS_NAME USED_SIZE(MB)
> --------------- -------------------------
> a 8
> b 14
> c 30
> d 40
> e 30
>
> How to use the SQL to finish it?
>
> Best Regards
> Quanwen Zhao
>

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Apr 10 2023 - 16:56:16 CEST

Original text of this message