question

artisltover avatar image
artisltover asked

I have a select statement what is best way to exclude from the select a coalesce?

Railey, Chaunnah (Contr)

11:57 AM (0 minutes ago)

tome

Here is the Select. Below is what needs to not be included.


SELECT x.ODOBNM,

x.ODOBTP,

x.ODOBAT,

x.ODCDAT,

x.ODUDAT

FROM HERAPERM.SCRUBLIB AS x

WHERE x.ODOBNM NOT IN (SELECT y.JOOBJ

FROM scrub_activity_sum AS y

WHERE activity_type NOT IN ('admin', 'system')

/* Filters objects created in current year and less than filter month */

AND y.JOOBJ IS NULL)

AND x.ODCRTS = 'ENDEAVOR'

/* Ignore objects created on EndDr/DPITest for Endeavor cleanup */

/* 12-2020 */

AND x.ODOBNM <> 'QDFTJRN' /* Ignore journal manager dtaara */

AND x.ODOBTP <> 'QMQRY' /* Ignore Query Objects // 12-2020 */

AND x.ODOBTP <> 'QRYDFN' /* Ignore Query Objects // 12-2020 */




The code of the rows not to be included.



COALESCE(NULLIF(SUBSTR(ODUDAT, 5, 2) || SUBSTR(ODUDAT, 1, 4), ''), SUBSTR(ODCDAT, 5, 2) || SUBSTR(ODCDAT, 1, 4)) > TO_CHAR(

CURRENT_DATE - 2 MONTHS, 'YYMMDD'))


db2
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.