1

I have query which returns some rows with null columns. I wanted only get the rows which have null columns. here is my query

SELECT
eofficeuat.gatepass.agent_id,
eofficeuat.cnf_agents.agent_name,
eofficeuat.entrylog_vehicle.passnumber AS passnumber,
eofficeuat.gatepass.id,
eofficeuat.entrylog_vehicle.action,
to_char(eofficeuat.gatepass.issuedatetime, 'dd-mm-yyyy HH12:MI:SS PM')  AS issueddatetime

FROM
eofficeuat.gatepass
inner JOIN eofficeuat.cnf_agents ON eofficeuat.gatepass.agent_id = eofficeuat.cnf_agents.agent_id
left JOIN eofficeuat.entrylog_vehicle ON eofficeuat.gatepass.id = eofficeuat.entrylog_vehicle.passnumber

WHERE
trunc((eofficeuat.gatepass.issuedatetime - DATE '1970-01-01') * 60 * 60 * 24) - 21602 >= 1569952800
AND trunc((eofficeuat.gatepass.issuedatetime - DATE '1970-01-01') * 60 * 60 * 24) < (
    SELECT
        ( sysdate - DATE '1970-01-01' ) * 86400000
    FROM
        dual
)

order by eofficeuat.gatepass.issuedatetime desc

this showing output like this image in the link https://gyazo.com/e9e150547b8f104f832cd190ff5392a2

can you please help for this? thanks

3
  • Why < ( SELECT ( sysdate - DATE '1970-01-01' ) * 86400000 FROM dual )? Just write < ( sysdate - DATE '1970-01-01' ) * 86400000 Commented Oct 2, 2019 at 6:26
  • Please don't paste link to images. User formatted text for result. This page may help you to format it. Commented Oct 2, 2019 at 6:28
  • You WHERE condition looks a bit weird. You can write is simpler like WHERE TRUNC(eofficeuat.gatepass.issuedatetime) - (6/24) >= to_date('2019-10-01 20:00', 'YYYY-MM-DD HH24:MI') AND TRUNC(eofficeuat.gatepass.issuedatetime) < sysdate. You don't have to screw with Unix timestamps. Commented Oct 2, 2019 at 6:43

1 Answer 1

2

I can't view images, but - if I understood the question, that would be

where (   agent_id   is null 
       or agent_name is null
       or passnumber is null
       or ...
     )
Sign up to request clarification or add additional context in comments.

3 Comments

I'm glad if it is.
how can i remove or not showup passnumber columun from my query
Just omit it from the SELECT statement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.