Execute SELECT query using CASE/ IF...ELSE statement

Phil Grainger

Execute SELECT query using CASE/ IF...ELSE statement
Actually, how CAN there be duplicates?

In your original question aren’t the predicates mutually exclusive?

And if the fields CUA1 and/or PONO ARE null, do they BOTH have to be null or just one of them?

Predicate 1 is “IF CUA1 IS NOT NULL AND PONO IS NOT NULL”

Then predicate 2 (the else) becomes “IF NOT (CUA1 IS NOT NULL AND PONO IS NOT NULL)”

________________________________

Phil Grainger

Enablement Manager

[login to unmask email]

Direct



+44 (0)118 921 8000

Mobile



+44(0)7808 643 479


E2, Eskdale Road
Winnersh
Berkshire
RG41 5TS


[http://media.cms.bmc.com/images/corp_signature_bmclogo_2014.jpg] http://www.bmc.com

[cid:[login to unmask email]






From: Grainger, Phil
Sent: 22 November 2017 11:49
To: '[login to unmask email]' <[login to unmask email]>
Subject: RE: Execute SELECT query using CASE/ IF...ELSE statement

Depends whether you use UNION or UNION ALL surely

________________________________

Phil Grainger

Enablement Manager

[login to unmask email]<mailto:[login to unmask email]>

Direct



+44 (0)118 921 8000

Mobile



+44(0)7808 643 479


E2, Eskdale Road
Winnersh
Berkshire
RG41 5TS


[http://media.cms.bmc.com/images/corp_signature_bmclogo_2014.jpg] http://www.bmc.com

[cid:[login to unmask email]






From: Bhumika Lekurwale [mailto:[login to unmask email]
Sent: 21 November 2017 17:13
To: [login to unmask email]<mailto:[login to unmask email]>
Subject: [DB2-L] - RE: Execute SELECT query using CASE/ IF...ELSE statement


Hi Phil,

But what if the Values for (CUA1, PONO) will be available in both the query.

It will create duplicate records.

Thanks,

Bhumika

-----End Original Message-----
BMC Software Limited Registered Office: Building E2, Eskdale Road, Winnersh, Wokingham, Berkshire, United Kingdom, RG41 5TS Registered in England No. 1927903 The content of this email is confidential. If you are not the addressee, you may not distribute, copy or disclose any part of it. If you receive this message in error, please delete this from your system and notify the sender immediately.
Attachments

  • image001.jpg (8k)
  • image003.png (5.9k)
  • image004.png (5.9k)