Skip to Content

HANA Query to Exclude Cancelled Journal Entry

I'm creating a report and I don't want the canceled journal entries to appear. I have this query below but it is working in SQL can anyone help me to convert it into HANA?

SELECT T0.TransId FROM OJDT T0 WHERE (T0.TransId not IN (SELECT T0.StornoToTr FROM OJDT T0 where t0.stornototr is not NULL)) AND (t0.stornototr is NULL)
Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jul 27, 2020 at 11:45 PM

    Hi,

    Also change IS NULL to IF NULL for HANA query.

    Regards,

    Nagarajan

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 28, 2020 at 07:59 AM

    IFNULL/ISNULL difference only neccessary if converting NULL field to some value, for example IFNULL(Field, ''). When making a WHERE clause that a certain field has to be NULL value to show result then correct syntax is "Field IS NULL". The below query should do the trick:

    SELECT T0."TransId" FROM OJDT T0 WHERE (T0."TransId" NOT IN (SELECT T0."StornoToTr" FROM OJDT T0 WHERE T0."StornoToTr" IS NOT NULL)) AND (T0."StornoToTr" IS NULL)
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.