Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to check if specified date contains in records or not
    primarykey
    data
    text
    <p>I want something strange here. I've table names as <code>EMP_INFO</code> which contains few details of an employee (i.e. Name,Designation, JOIN_FROM, JOIN_TO). I am trying to figure out term for each employee on yearly basis. I've below types of data</p> <pre><code>EMP_ID EMP_DESIG JOIN_FROM JOIN_TO Query Result 1 Supervisor 01-05-11 30-04-13 Should Display 2 Supervisor 15-06-10 31-12-12 Should Display 3 Jobar 01-01-12 31-12-13 Should Display 4 SR Superior 01-12-11 31-12-15 Should Display 5 Supervisor 01-05-11 31-12-13 Should Display 6 Supervisor 01-05-11 31-12-13 Should Display 7 Supervisor 01-05-11 31-12-13 Should Display 8 Supervisor 01-02-12 15-06-13 Should Display 9 SR Superior 16-03-10 18-11-11 Should Display 10 SR Superior 16-06-05 18-11-11 Should Display 11 Jobar 30-11-11 31-12-13 Should Display 12 Superior 02-02-05 31-12-20 Should Display 13 Jobar 30-11-11 31-12-13 Should Display 14 Jobar 30-11-09 31-12-10 Should Not Display </code></pre> <p>Basically what i need is I have date range in my report and let's say From: "01-Jun-11" To "31-Dec-13". From above record set report should retrieve all records as all records contains this both dates. </p> <p>I have tried by using BETWEEN syntax but i believe it will not work. </p> <p>If anyone can help me in this than it would be appreciated.</p> <p>Thanks in Advance.. And one more thing if this details is not enough to understand than let me know i will add more in details.</p> <p><strong>Modified</strong> Query which I tried</p> <pre><code>SELECT EI.* FROM EMP_INFO EI, (SELECT TO_DATE('01-JUN-2011','DD-MON-YYYY') A, TO_DATE('31-DEC-2013','DD-MON-YYYY') B FROM DUAL) X WHERE (EI.JOIN_FROM IS NOT NULL AND EI.JOIN_TO IS NOT NULL) AND ( X.A BETWEEN EI.JOIN_FROM AND EI.JOIN_TO AND X.B BETWEEN EI.JOIN_FROM AND EI.JOIN_TO OR (EI.JOIN_FROM &gt;= X.B AND EI.JOIN_TO &lt;=X.A) ) </code></pre> <p><strong>Modified</strong> Added column (Query Result) on above table which contains result for each record.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload