Overlapping date problem, I'm a bit stumped...

Hi,
My first post here, woohooo!!
I'm trying to write some SQL for overlapping dates, hoping someone could point me in the write direction because I'm a bit stuck :(
Heres the scenario....
Tables are simillar to this (although I've changed it for the sake of this example).
TABLE A, TABLE B, TABLE C look like this
- EMPLOYEE_NUMBER VARCHAR2
- START_DATE DATE
- END_DATE DATE
These three tables contain information on an employees working period. The dates in each table can overlap each other.
For example
TABLE A
AAAA, 05-10-1991, 05-10-2020
AAAA, 05-01-2000, 20-05-2003
BBBB, 09-12-1999, 02-07-2009
TABLE B
AAAA, 01-11-2002, 01-09-2003
TABLE C
AAAA, 15-08-2003, 12-05-2004
Heres the tricky bit. There is a hierarchy, any dates in table C will overide any of the dates in table A and B. Table B will override any dates Table A. I need a query to break up the dates to show one consecutive timeline for any given employee. The query would obviously need to use all 3 tables.
Therefore I would need a query to output the following for Employee AAAA.
EMPLOYEE, START_DATE, END_DATE
AAAA, 05-10-1991, 04-01-2000
AAAA, 05-01-2000, 31-10-2002
AAAA, 01-11-2002, 14-08-2003
AAAA, 15-08-2003, 12-05-2004
AAAA, 13-05-2004, 05-10-2020
I've worked out how to write this using PLSQL although its pretty feral code, hoping there might be a cleaner method using SQL. Any ideas anyone?
Thanks!
Edited by: user2322009 on 1/03/2009 21:17

in addition to avinash solution and using the data that is provided by you.
with t as (SELECT 'AAAA' emp_id, TO_DATE('05-10-1991','DD-MM-YYYY') start_dt, TO_DATE('05-10-2020','DD-MM-YYYY') end_dt FROM DUAL UNION ALL
    SELECT 'AAAA', TO_DATE('05-01-2000','DD-MM-YYYY'), TO_DATE('20-05-2003','DD-MM-YYYY') FROM DUAL UNION ALL
    SELECT 'AAAA', TO_DATE('01-11-2002','DD-MM-YYYY'), TO_DATE('01-09-2003','DD-MM-YYYY') FROM DUAL UNION ALL
    SELECT 'AAAA', TO_DATE('15-08-2003','DD-MM-YYYY'), TO_DATE('12-05-2004','DD-MM-YYYY') FROM DUAL )
, t1 as (    select emp_id,max(end_dt) m_dt from t
            group by emp_id)
, t2 as (select t1.emp_id, max(end_dt) m_dt from t,t1
             where t.emp_id = t1.emp_id
             and end_dt <> m_dt
             group by t1.emp_id
SELECT emp_id,start_DT, CASE WHEN start_dt_pr < end_dt THEN start_dt_pr -1 ELSE end_dt END  FROM (
    SELECT emp_id,start_dt,NVL(LEAD(start_dt,1) OVER(ORDER BY start_dt),end_dt)  start_dt_pr, end_dt FROM (
    SELECT emp_id,start_dt,end_dt FROM T ORDER BY start_dt ))
union all
select t1.emp_id,t2.m_dt + 1, t1.m_dt from t1,t2
where t1.emp_id = t2.emp_id;See if this helps.
Avinash solutions was missing one record if i use the data provided by you. That is the last record.
Following was added to get the last record. Experts here will correct me if this is not the right way to do.
, t1 as (    select emp_id,max(end_dt) m_dt from t
            group by emp_id)
, t2 as (select t1.emp_id, max(end_dt) m_dt from t,t1
             where t.emp_id = t1.emp_id
             and end_dt <> m_dt
             group by t1.emp_id
             )Alvinder

Similar Messages

  • Overlapping components problem

    Hello,
    I have been developing an applet for Quickplaces. Basically it shows what is happening in the Quickplace from different kind of views. A view from a document where people can see who has been viewing it for example. Or a view from a member where one can see what documents the member wrote.
    Now I have chosen to implement a sort of circle visualisation for this. In the center is the object the view is about, a document, a member, etc. Outwards are other objects. In the case of a document view, the members that responded to it, in a circle more outward: members that viewed it. Etc. It's sort of a dartboard.
    I have written a custom layoutmanager for each view for this. A problem I have encountered is that once I tell a member or document component to let itself be placed by the layout managerr I get a fixed size component. It looks ok until you for example hover over it, wich I have keyed to a zooming in on details method. When you do that your usually overlapping other components. Why, components can be overlapped without zooming in some views. The problem is the mouselistener I have attached fires when I hover over de component size. Not the size of the actual graphical representation. My members for example are represented by a sphere. They are bounded by a rectangle component though. So if I enter my mouse anywhere near the sphere... it already zooms in, resulting in the user zooming in on a member, but actually he wanted to zoom in on a member that was close to this one, but for the code was "underneath" the component of the other member.
    It's a bit hard to explain without posting a screenshot.
    How do I fix this?

    Hi,
    I need a clarification, taking the example you
    provided:
    you have a rectangle components, that display spheres.I have a viewer class for document's member's and room's. RoomViewer, MemberViewer, etc. These paint the actual graphic. They are given a size by the custom layoutmanager i wrote like this:
            //Layout members
            int mems = members.size();
            if(mems != 0){
                double angle = 360 / mems;
                double baseAngle = 0;
                synchronized(members){
                     Iterator iter = members.iterator();
                     while(iter.hasNext()){
                         MemberViewer tempMember = (MemberViewer)iter.next();
                         Dimension d = tempMember.getSize();
                         double lastLog = tempMember.getMember().getLastLog() * 160 + Math.sqrt((Math.pow(50, (double)2) + Math.pow(50, (double)2)));
                         int xCoord = (int)((xCenter + (Math.cos(Math.toRadians(baseAngle)) * lastLog)) - (0.5 * d.getWidth()));
                         int yCoord = (int)((yCenter + (Math.sin(Math.toRadians(baseAngle)) * lastLog)) - (0.5 * d.getHeight()));
                         tempMember.setBounds(xCoord, yCoord, container_size, container_size);
                         baseAngle += angle;
            }A viewer get's it's data from the model class. MemberViewer from Member, etc.
    First you want to zoom only when the mouse is hovered
    on the sphere. Is that right ?Yes I have implemented the enters part of the mouselistener. As soon as the mouse enters the component in wich the graphical representation is drawn it zooms. with zoom I multiply the size by some and add some different graphs inside the circle, but that is not important. What is interesting is probably that the size of the component when it is not zoomed is the size for when it is zoomed in, or the zoom in would be cut off by the component boundaries.
    What about the overlapping ? could you clarify a bit
    please.
    Basically it overlaps nicely on the view. Once you interact though I get stuck. Clicking, entering and exiting is supposed to do things. But all these 3 fire when your mouse does that thing inside the component, not inside the graphical representation. So you start zooming quite a bit away from the circle of a member btw, because that distance is already part of the component, but not of the drawing.
    Who is reponsible for drawing the shapes ?The Viewers paint themselves. The Layoutmanager gives them a basic place to start their own painting and a View class controls the layoutmanager.
    And who listens to mouse motion ?The viewers themselves do. They implement mouseListener.
    in mouseMoved(MouseEvent e)
    you can get the point with e.getPoint(); where the
    mouse points to.
    This will help you to handle the event only when
    hovered on the shape,
    but it will maybe not solve the hovering over
    overlapped components.I don't quite follow that. A Shape can still not implement MouseListener.

  • Looking for a query to find first/last dates in overlapping dates...

    Hi,
    I'm looking for a query to find the first dates and last dates in a table conaining overlapping dates.
    I have a subscription table which has for each Customer start and end date for different subscriptions.
    I want to know the different ranges of date where there is subscriptions active.
    so if the table has this:
    CustID, Start date, end date
    1, 2008-01-01, 2012-06-06
    1 ,2009-01-01, 2011-01-01
    1, 2011-01-01, 2013-02-02
    1, 2013-01-01, 2013-08-08
    1, 2014-01-01, 2014-04-04
    I want to produce this result:
    custid, range start, range end
    1, 2008-01-01, 2013-08-08
    1, 2014-01-01, 2014-04-04
    the first row is the range identified from the 4 rows in my subscription table.
    thanks :)

    I think I found it...
    http://stackoverflow.com/questions/5213484/eliminate-and-reduce-overlapping-date-ranges
    let me try this method
    Hi,
    m writing to follow up with you on this post. Thanks for you posting a reply to share your workground. Was the problem resolved after performing the above link? If you are satisfied with the above solution, I’d like to mark this issue as "Answered".
    Please also feel free to unmark the issue, with any new findings or concerns you may have.
    Thanks,
    Sofiya Li
    If you have any feedback on our support, please click here.
    Sofiya Li
    TechNet Community Support

  • Overlap date Issue 0hrposition_attr

    Hi
    I'm facing one records overlap date Issue with 0hrposition_attr.Out of 4  records one records i'm getting as start date as future date and end date as past date.I checked in the source i did not see such records.Due to this issue the records are not updated in the target.But i did not notice such issue with 0hrposition_Text  and 0HRPOSITION_CCTR_ATTR load went fine with out any over lap.
    Eg:
    POSITION          VALID FROM          VALID TO
    12345678            04/01/2014            04/20/2014
    12345678            04/21/2014            04/24/2014
    12345678            04/25/2014            04/24/2014
    12345678            04/25/2014            12/31/9999
    I debug  but i did not see any issue,So there any way that  i can delete that particular  records at PSA level so that loads went successful.I attacdshed the document for better idea.
    Regards
    Raj

    Hi,
    only these record is getting the problem and all records.
    check the one record at RSA3 for testing purpose same record check in BW side.
    if you getting like this not problem you can check the only latest record
    12345678       
    04/25/2014       
    12/31/9999
    put the filter at VALID TO data 12/31/9999 and form date 04/25/2014.
    you want lookup the code just add the one more point.
    WHERE POSITION = RESULT_PACKAGE- 0POSITION
         and DATETO = '99991231'.
    it will pick the only latest record.
    Thanks,
    Phani.

  • Problem with number of bits........

    Hello every one here........
    I have a problem while converting a string of bits into characters...........my method is something like this......I am giving a string on client side....converting that string into string of bits and sending the bits to server side....now my problem is how to convert this string of bits into string which i originally gave at client side......
    I used a method as shown below:
    while(str.length()>0)
              i=7;
              System.out.print((char)Integer.parseInt(str.substring(0,i),2));
              str=str.substring(i);
    here "str" is the string of bits which i received from client.......now coming to original problemEach character in the string which i gave on client side are converted to string of bits having 7 bits except the "space character" which is taking only 6 bits...... in my method as i am grouping 7 characters and printing the output i am getting wrong result after "space character"........
    can anyone solve my problem.....
    thanks in advance....
    Deepika

    class BitStuff
         public static void main(String args[])
              try{
              String str=JOptionPane.showInputDialog("Enter ur code");
              char ch[]=str.toCharArray();
              String bitString="";
              String stuffedBits[]=new String[10000];     
              String stuffedString="";
              String counts;
    /*here i am ensuring dat each character generates 7 bits*/
              for(int i=0;i<ch.length;i++)
                   counts=(Integer.toBinaryString(ch));
                   if(counts.length()<7)
                        for(int j=counts.length();j<7;j++)     
                        counts="0".concat(counts);
                   bitString=bitString.concat(counts);
              String bitsArray[]=bitString.split("11111");
              for(int i=0;i<bitsArray.length;i++)
                   stuffedBits[i]="111110".concat(bitsArray[i]);
                   stuffedString=stuffedString.concat(stuffedBits[i]);
              stuffedString=stuffedString.replaceFirst("111110","");
              stuffedString="01111110".concat(stuffedString);
              stuffedString=stuffedString.concat("01111110");
              System.out.println(stuffedString);
              Socket s=new Socket("localhost",8280);
              OutputStream os=s.getOutputStream();
              byte b[]=stuffedString.getBytes();
              os.write(b,0,b.length);}
              catch(Exception e)
              {System.out.println(e);}
    as the ascii of space is 32 it is 100000 here the method returns as 100000 instead of 0100000......

  • Solution for Overlapping dates

    Hi
    I am looking for an easy solution the problem described below
    I have 4 records under party key and
    PartyKey account id taxtype date start date end
    123 145 100 01/01/2001 12/31/2002
    123 145 100 05/01/2001 05/31/2001
    123 145 100 01/01/2002 11/30/2002
    123 145 100 01/01/2003 12/31/2007
    124 111 300 01/01/2001 12/31/2006
    125 222 260 04/01/2001 11/30/2001
    125 222 260 01/01/2001 12/31/2001
    I want to select all the records which has overlapping dates with other set of record for the same partykey and other columns and want to list all those records which has no overlapping dates.
    for example for party key 123 first 3 records are overlapping date, and party key 125 has both the records has overlapping date.
    party key 124 has no over lapping date and last record of partykey 123 the dates are not overlapping with first three records
    Can any body help me in building the code. Its very Urgent please
    Thanks
    Rajesh

    My bad, i had to head out shortly so i rushed, and introduced some copy+paste errors....This should be what you're after, hopefully you'll take the time to understand it, since you'll have to support it :)
    ME_XE?select
      2     id_internal,cd_type_acct,cd_type_addr,id_acct,  dt_effect, dt_end,
      3     case when
      4        (dt_effect between lead(dt_effect) over (partition by id_internal,cd_type_acct,cd_type_addr,id_acct order by id_internal,cd_type_acct,cd_type_addr,id_acct, dt_effect asc) AND lead(dt_end) over (partition by id_internal,cd_type_acct,cd_type_addr,id_acct order by id_internal,cd_type_acct,cd_type_addr,id_acct, dt_effect asc) )
      5        OR
      6        (dt_end between lead(dt_effect) over (partition by id_internal,cd_type_acct,cd_type_addr,id_acct order by id_internal,cd_type_acct,cd_type_addr,id_acct, dt_effect asc) AND lead(dt_end) over (partition by id_internal,cd_type_acct,cd_type_addr,id_acct order by id_internal,cd_type_acct,cd_type_addr,id_acct, dt_effect asc) )
      7        OR
      8        (dt_effect between lag(dt_effect) over (partition by id_internal,cd_type_acct,cd_type_addr,id_acct order by id_internal,cd_type_acct,cd_type_addr,id_acct, dt_effect asc) AND lag(dt_end) over (partition by id_internal,cd_type_acct,cd_type_addr,id_acct order by id_internal,cd_type_acct,cd_type_addr,id_acct, dt_effect asc) )
      9        OR
    10        (dt_end between lag(dt_effect) over (partition by id_internal,cd_type_acct,cd_type_addr,id_acct order by id_internal,cd_type_acct,cd_type_addr,id_acct, dt_effect asc) AND lag(dt_end) over (partition by id_internal,cd_type_acct,cd_type_addr,id_acct order by id_internal,cd_type_acct,cd_type_addr,id_acct, dt_effect asc) )
    11    then
    12     'Overlap'
    13    else
    14     'No Overlap'
    15    end as overlaps
    16  from
    17  (
    18     select *
    19     from MV_ITS_PARTY_ADDRESS_EXCEP
    20     order by id_internal,cd_type_acct,cd_type_addr,id_acct, dt_effect asc
    21  );
           ID_INTERNAL       CD_TYPE_ACCT       CD_TYPE_ADDR ID_ACCT                              DT_EFFECT  DT_END     OVERLAPS
                 93535       300000042829                 10 300                                  10/01/2000 10/31/2000 Overlap
                 93535       300000042829                 10 300                                  10/01/2000 10/31/2000 Overlap
                 93535       300000042829                 10 300                                  11/01/2000 12/31/2001 No Overlap
           20001115051                  0                 60 0                                    01/01/2004 12/31/2004 No Overlap
           20001115051                  0                 60 0                                    01/01/2005 12/31/2005 No Overlap
           20001115051                  0                 60 0                                    01/01/2006 02/27/2006 Overlap
           20001115051                  0                 60 0                                    01/01/2006 02/27/2006 Overlap
           20001115051                  0                 60 0                                    01/01/2006 02/27/2006 Overlap
           20001115051                  0                 60 0                                    01/01/2006 02/27/2006 Overlap
           20001115051                  0                 60 0                                    01/01/2006 02/27/2006 Overlap
           20001115051                  0                 60 0                                    02/28/2006 12/31/9999 No Overlap
    11 rows selected.
    Elapsed: 00:00:00.18
    ME_XE?
    [pre]
    Message was edited by:
            Tubby                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Overlapping dates not found

    Hi Friends,
    I had created a project, with two wbs elements at level 1 and 2. Assigned a network and an activity to it. Maintained all the parameters required.
    The project is saved. Later if i want to make any changes to the project and try to save, it is not allowing me to save the changes. It is showing an message"Overlapping dates not found".
    Can anyone help me fix this problem.
    Regards,
    T.V.REDDY

    Hi
    WBS Element is a Time dependant master data object,So please check the data with dates...
    Please have a look at the below url
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=time%20dependant%20master%20data&cat=sdn_all
    Hope it helps
    Thanks
    Teja

  • Overlapping Dates , Denormaization of the tables

    Hi Guys,
    I am in a situation that we are denormalising few tables for better performance and reduce the joins. For which I am joining the tables using the logic to check for the dates and add the fields corresponding to those dates to represent the joined data correct at any given point of time . A simple example is :
    In the below tables : in Table1, the case_number 0023A is having Status "AC" during the time period 15-jan-08 and 31-dec-9999 ( open-ended or current date), and in Table2 the same case is having center_code "C12" during 22-jun-08 and 31-dec-9999 . When the tables are joined the over-lapped dates will be having common data like *0023A, 22-JUN-2008, 31-DEC-9999, AC, C12*
    My [previous posting|http://forums.oracle.com/forums/thread.jspa?forumID=75&threadID=682324] on the forums which has been answered by Frank and was perfectly working for me in getting the results for different data as in the above mentioned thread, but the present data set is throwing me the problem by not selecting the Non-Overlapping Dates
    CREATE TABLE TABLE1 (
    CASE_NUMBER VARCHAR2(5),
    CHANGE_EFF_DATE DATE,
    END_EFF_DATE DATE,
    STATUS VARCHAR2(2) );
    INSERT INTO TABLE1 VALUES
    ( '0023A'
    ,TO_DATE('15-JAN-2008','DD-MON-YYYY')
    ,TO_DATE('31-DEC-9999','DD-MON-YYYY')
    ,'AC'
    INSERT INTO TABLE1 VALUES
    ( '0023A'
    ,TO_DATE('07-OCT-2007','DD-MON-YYYY')
    ,TO_DATE('14-JAN-2008','DD-MON-YYYY')
    ,'CL'
    INSERT INTO TABLE1 VALUES
    ( '0023A'
    ,TO_DATE('08-APR-2007','DD-MON-YYYY')
    ,TO_DATE('06-OCT-2007','DD-MON-YYYY')
    ,'AC'
    INSERT INTO TABLE1 VALUES
    ( '0023A'
    ,TO_DATE('13-MAR-2007','DD-MON-YYYY')
    ,TO_DATE('07-APR-2007','DD-MON-YYYY')
    ,'RJ'
    INSERT INTO TABLE1 VALUES
    ( '0023A'
    ,TO_DATE('31-MAY-2005','DD-MON-YYYY')
    ,TO_DATE('12-MAR-2007','DD-MON-YYYY')
    ,'AP'
    CREATE TABLE TABLE2 (
    CASE_NUMBER VARCHAR2(5),
    CHANGE_EFF_DATE DATE,
    END_EFF_DATE DATE,
    CENTER_CODE VARCHAR2(3) );
    INSERT INTO TABLE2 VALUES
    ( '0023A'
    ,TO_DATE('22-JUN-2007','DD-MON-YYYY')
    ,TO_DATE('31-DEC-9999','DD-MON-YYYY')
    ,'C12'
    INSERT INTO TABLE2 VALUES
    ( '0023A'
    ,TO_DATE('09-MAR-2007','DD-MON-YYYY')
    ,TO_DATE('21-JUN-2007','DD-MON-YYYY')
    ,'101'
    SQL> SELECT * FROM TABLE1;
    CASE_ CHANGE_EF END_EFF_D ST
    0023A 15-JAN-08 31-DEC-99 AC
    0023A 07-OCT-07 14-JAN-08 CL
    0023A 08-APR-07 06-OCT-07 AC
    0023A 13-MAR-07 07-APR-07 RJ
    0023A 31-MAY-05 12-MAR-07 AP
    SQL> SELECT * FROM TABLE2;
    CASE_ CHANGE_EF END_EFF_D CEN
    0023A 22-JUN-07 31-DEC-99 C12
    0023A 09-MAR-07 21-JUN-07 101 -----
    Here is the query I am running to get the joined information from both the tables with regards to specific point in time.
    SELECT T1.CASE_NUMBER
    ,GREATEST(T1.CHANGE_EFF_DATE,T2.CHANGE_EFF_DATE) CHANGE_EFF_DATE
    ,LEAST(T1.END_EFF_DATE,T2.END_EFF_DATE) END_EFF_DATE
    ,T1.STATUS
    ,T2.CENTER_CODE
    FROM
    TABLE1 T1
    LEFT OUTER JOIN
    TABLE2 T2
    ON
    T1.CASE_NUMBER=T2.CASE_NUMBER AND
    T1.CHANGE_EFF_DATE &lt;= T2.END_EFF_DATE AND
    T2.CHANGE_EFF_DATE &lt;= T1.END_EFF_DATE
    ORDER BY 2;
    Here is the result-set I am getting :
    CASE_ CHANGE_EF END_EFF_D ST CEN
    0023A 09-MAR-07 12-MAR-07 AP 101
    0023A 13-MAR-07 07-APR-07 RJ 101
    0023A 08-APR-07 21-JUN-07 AC 101
    0023A 22-JUN-07 06-OCT-07 AC C12
    0023A 07-OCT-07 14-JAN-08 CL C12
    0023A 15-JAN-08 31-DEC-99 AC C12But my result-set should include the Non-Overlapping dates as well which should look like this, but I am missing the top record ( First record) in my output :
    CASE_ CHANGE_EF END_EFF_D ST CEN
    0023A 31-MAY-07 08-MAR-07 AP
    0023A 09-MAR-07 12-MAR-07 AP 101
    0023A 13-MAR-07 07-APR-07 RJ 101
    0023A 08-APR-07 21-JUN-07 AC 101
    0023A 22-JUN-07 06-OCT-07 AC C12
    0023A 07-OCT-07 14-JAN-08 CL C12
    0023A 15-JAN-08 31-DEC-99 AC C12I shall be really thankful if you guys can me help me .
    Thanks.
    Venu
    Edited by: Oracle, Developer on Dec 11, 2008 9:30 PM

    Hi, Venu,
    If I understand the problem correctly, you need a row in table2 that covers all dates before the earliest change_eff_date, similar to the way you have a row that covers all dates after the latest change_eff_date. You don't have to store such a row in the table: you can generate one at run time, and use UNION to add it to your real data.
    WITH     t2     AS
         SELECT     case_number
         ,     change_eff_date
         ,     end_eff_date
         ,     center_code
         FROM     table2
         UNION
         SELECT     case_number
         ,     TO_DATE (1, 'J')          AS change_eff_date     -- Earliest possible date
         ,     MIN (change_eff_date) - 1     AS end_eff_date
         ,     NULL                    AS center_code
         FROM     table2
         GROUP BY     case_number
    SELECT     T1.CASE_NUMBER
    ,     GREATEST (T1.CHANGE_EFF_DATE, T2.CHANGE_EFF_DATE)     CHANGE_EFF_DATE
    ,     LEAST (T1.END_EFF_DATE ,T2.END_EFF_DATE)          END_EFF_DATE
    ,     T1.STATUS
    ,     T2.CENTER_CODE
    FROM          TABLE1     T1
    LEFT OUTER JOIN          T2
    ON     T1.CASE_NUMBER          =  T2.CASE_NUMBER
    AND     T1.CHANGE_EFF_DATE     <= T2.END_EFF_DATE
    AND     T2.CHANGE_EFF_DATE     <= T1.END_EFF_DATE
    ORDER BY 1, 2;Note that the main query is exactly what you had before, except for the definition of t2.
    Where t2 had been simply table2, now it is the UNION of table2 with one row per case_number, with a change_eff_date in 4712 BCE.

  • Undocumented problem solved with 16-bit pcmcia and irq error

    I am having the exact same problem as described in the following post:
    "Undocumented problem solved with 16-bit pcmcia and irq error."
    "I'm using a DAQ Card (AI-16E-4), which didn't work properly in MAX. MAX complained that the card didn't respond to an interrupt request.
    I've had this issue for a while, but dropped it, since NI support told me nothing could be done about it. Meanwhile, a seemingly unrelated problem with a wireless pcmcia network card arose. Cisco had no clue what was wrong with their card either, but I found Microsoft Knowledge Base Article Q327947. It seems that Win2k (they claim SP3 and up) disables ISA to PCI routing, which is what causes this problem.
    To fix it, open regedit
    and navigate to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Pcmcia\Parameters"
    edit or create the DWORD value "DisableIsaToPciRouting" and set the value data to 0.
    See Microsoft's article for further details: http://support.microsoft.com/default. aspx?scid=kb;en-us;327947"
    The difference is that I am using WinXP and the Regedit fix does not solve the problem. Does anybody know how he was able to continue to use the card before he solved the problem? The card works fine in MAX, but errors out in LabVIEW.

    Hey Willy,
    Here some additional suggestions that have corrected some PCMCIA difficulties in the past besides the registry edit you suggested.
    1. General Troubleshooting to Verify Correct Hardware and Software Installation
    Uninstall the PC Card hardware through Device Manager
    Remove the PC Card from the laptop
    Uninstall the NI-DAQ software
    Follow the normal installation instructions (the most important step to remember for Plug-n-Play Operating Systems is to install the software first)
    Try the latest service packs for Win 2000 or Win XP
    Try the PC Card in a different laptop
    Try a different slot in the laptop. On certain laptops PC Cards have been successfully installed in the top PCMCIA slot instead of the bottom.
    2. Additional Troubleshootin
    g for PC Cards that Return IRQ Conflicts
    For E-Series DAQCards:
    Update to NI-DAQ 6.9.3 first and then update NI-PAL to version 1.6.1 (included exe file).
    Download the attached NI-PAL (ni-cdu1610.exe), and run the installer. When receiving the error "The device is not responding to the first IRQ Level" in Measurement and Automation Explorer, try this method of upgrading NI-PAL
    3. Additional Troubleshooting Steps
    Try disabling the 3COM adapter, and any other extraneous (for now) devices like any built in serial and parallel ports. The best way to do this is probably to disable them in the BIOS. If the PCMCIA card works properly then try to reconfigure disabled devices one at a time.
    Make sure the latest BIOS is installed.
    Check for any unusual PCMCIA drivers or other software that might interfere with the PCMCIA driver.
    I hope this helps.
    Ron
    Applications Engineering
    National Instruments
    Attachments:
    ni-cdu1610.exe ‏1557 KB

  • Help needed with missing data problem in CRVS2010

    We recently upgraded the reporting engine in our product to use Crystal Reports for Visual Studio 2010 (previously engine was CR9). Our quote report, which has numerous subreports and lots of conditional formatting, started losing data when a quote took more than a single page to be printed. We knew the SQL results included the data, but the report was not printing those lines at all or sometimes printing a partial line. In addition, the running total on the report would exclude the lines that were being missed on the next page. In one example submitted by a customer, 3 lines were skipped between pages.
    I think I have identified two potential issues that document the possibility of data not being included in the report.
    The first potential issue is an issue with the "suppress blank section" option being checked. This issue is supposedly fixed with ADAPT01483793, being released someday with service pack 2 for CRVS2010.
    The second potential issue is using shared variables. This issue is supposedly fixed with ADAPT01484308, also targeted for SP2.
    Our quote report does not explicitly use shared variables with any of the subreports, but it does have several subreports, each in its own section that has the "supress blank section" option checked. We have other reports that use this feature, as well, and they are not exhibiting the problem.
    One different thing about the quote report is that it has a section with multiple suppression options selected. The section has a conditional suppression formula, which controls whether the section is included at all within the report. The section also has the suppress blank section option selected. There are multiple fields within the report that are each conditionally suppressed. In theory, the section's suppress formula could evaluate to true, yet all of the fields within the section are suppressed (due to null values), and then the "suppress blank section" option would kick in.
    The missing data only seems to happen when the section is not being suppressed, and at least one of the fields is being included in the report. If I clear the "suppress blank section" check box, and change the section formula to also include the rules applied to the fields in the section, the missing data problem seems to be resolved.
    Is this related to ADAPT01483793? Will it be fixed in service pack 2?
    If more details are needed, I would be happy to provide a sample report with stored data.

    Hi Don,
    Have a look at the Record Selection formula in CR Designer ( stand alone ) and when exported to RPT format opening that report in the Designer also. 
    There's been a few issues with => logic in the record selection formula. It could be you are running into this problem. Look for NOT inserted into your selection formula.
    Oh and SP2 is coming out shortly so it may resolve the issue. But if you want you could purchase a support, or if you have a support contract then create a case in SMP and get a rep to work with you to debug the issue.
    If you have not try the Trial Version of CR 2011, put it on a VM-ware image or Test PC so you don't corrupt anything for production and have a look at and test it in that designer also. If you purchase a case and it is a bug then you'll get a credit back for the case.
    Don
    Edited by: Don Williams on Oct 26, 2011 7:40 AM

  • Clearing of Balance in GR/IR clearing account due to date problem

    >Hi to All,
    >The scenario is like this :-
    >The client is making back dated entries for quarter between 01.04.2008 to 30.06.2008 in SAP in July 2008 as the system is getting implemented now. He wants to regularise all the transactions in SAP from 01/04/2008.
    >The users entering the data were new and hence though the miro and payment entries were made by F&A in back date. The Purchase Orders and the GRs were prepared in the current date of July 2008.
    >Because of this date problem the GR/IR clearing account is having balance in it, which should have been clear after the processing of the miro document.
    >The documents were handed over to f&a after preparation of GR in the systems for Invoice processing through MIRO.
    >Can anyone plz give a solution to clear the balance GR/IR clearing account.
    >Thanks in advance.
    >Ashutosh M Joglekar.

    Hi Muthuraman,
    No need to clear any thing for PO pending items.
    Regards
    Gitesh

  • My macbook pro recently got swiped and I lost all my data, problem is, just before it was swiped I set up my new iphone 5 which transferred all my photos and music over which is no longer on the computer. What will happen to my phone if I plug it in?

    My macbook pro recently got swiped and I lost all my data, problem is, just before it was swiped I set up my new iphone 5 which transferred all my photos and music over which is no longer on the computer. What will happen to my phone if I plug it in?

    I never used icloud before so there is no data to back up from. I just spoke  to the apple store and they said that if I do plug it in, all the data will be swiped....is there a program I can use to transfer my data from my phone to computer without loosing it all ???
    Renee

  • Will apple next update to help fix the location following data problems will the ipod touch 2g be included ?

    will apple next update to help fix the location following data problems will the ipod touch 2g be included ?

    Chances are the 2g itouch will not be included in the update. Also no one yet knows if it will be fixed in the next firmware but apple has said they know of this bug.

  • Problems in IE9 32 bit browser but not 64 bit

    When I delete a message(s) in Yahoo Mail or when I go to my mortgage website and login, I get a blank page and then nothing happens.  I only get this problem in IE9 32 bit and not 64 bit.  I reset IE9 Options under the advanced tab, updated Java
    and Adobe, but the problem still persists.  I also did a viral scan using MSE and MalwareBytes and my computer is clean.  Can someone help.  Thank you

    IE9 is fairly old, upgrade you browser.

  • Need to find rows with overlapping dates

    I have a table that has FirstName, LastName, EnrollmentFrom and EnrollmentTo
    I need to find all names where they have overlapping dates.  For example this is invalid:
    Name       EnrollmentFrom     EnrollmentTo
    John Doe   1/1/2014              1/1/2015
    John Doe   2/5/2014              2/5/2014
    This would be valid:
    John Doe   1/1/2014              1/1/2015
    John Doe   1/2/2015              1/1/2016
    This is just an example as the dates could be anything in one of the other enrollments.
    Any help is greatly appreciated.

    Here is what I have based on the last post but it also returns ones that are valid:
    SELECT ffev.PatientLastName, ffev.PatientFirstName, ffev.EnrollmentFrom, ffev.EnrollmentTo
    FROM PAPPortal..FeedFileEnrollmentValues ffev
    OUTER APPLY (select top 1 b.* from PAPPortal..FeedFileEnrollmentValues b where ffev.PatientID = b.PatientID and b.EnrollmentFrom < ffev.EnrollmentTo and b.EnrollmentTo > ffev.EnrollmentFrom and ffev.PatientID <> b.PatientID) overlap
    WHERE ffev.EnrollmentTo IS NOT NULL
    GROUP BY ffev.PatientLastName, ffev.PatientFirstName, ffev.EnrollmentFrom, ffev.EnrollmentTo
    ORDER BY ffev.PatientLastName, ffev.PatientFirstName, ffev.EnrollmentFrom, ffev.EnrollmentTo
    Name              EnrollmentFrom         EnrollmentTo
    John Doe            2013-02-08            2014-02-07
    John Doe            2014-08-15            2015-08-15
    hi
    it seems you have given (= and <>) which is always return false(no records)
     where ffev.PatientID = b.PatientID and b.EnrollmentFrom < ffev.EnrollmentTo and b.EnrollmentTo > ffev.EnrollmentFrom and
           ffev.PatientID <> b.PatientID
    Note : i have given
    where a.ID=b.ID and b.DateFrom<a.DateTo and b.DateTo>a.DateFrom and
    a.rno<>b.rno
    If you don't have any unique column to differentiate you  can create rno with CTE and use like below
    DECLARE @Data AS TABLE
    -- rno int identity(1,1),
    ID int,
    DateFrom datetime,
    DateTo datetime
    INSERT INTO @Data VALUES (1, '1/1/2014', '1/1/2015')
    INSERT INTO @Data VALUES (1, '2/5/2014', '2/5/2014')
    INSERT INTO @Data VALUES (2, '1/1/2014', '12/31/2014')
    INSERT INTO @Data VALUES (2, '1/2/2015', '12/31/2016')
    ;WITH CTE1 as
    SELECT ROW_NUMBER() over(PARTITION by ID order by DateFrom,DateTo ) rno,* FROM @Data
    SELECT a.*, overlap.rno,overlap.DateFrom,overlap.DateTo
    FROM CTE1 a
    OUTER APPLY (select top 1 b.* from CTE1 b where a.ID=b.ID
    and b.DateFrom<a.DateTo
    and b.DateTo>a.DateFrom and a.rno<>b.rno) overlapwhere overlap.ID is not null
    Thanks
    Saravana Kumar C

Maybe you are looking for