Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
arpitkharkia
Creator III
Creator III

Compare dates from different records

Consider the following table:

LOAD * INLINE [

    GR, RT, QID, CD, Date

    1, 8, 11, 6/1/2017, 8/1/2017

    1, 10, 22, 9/1/2017, 8/1/2017

    1, 15, 33, 15/1/2017, 8/1/2017

    2, 9, 66, 4/1/2017,10/1/2017

    2, 12, 44, 8/1/2017, 10/1/2017

    2, 15, 55, 11/1/2017, 10/1/2017

];

If Date is greater than CD of the row and less than CD of the next row than that row has to be considered. For the above table i need the following output:

GRRTQIDCDDate
18116/1/20178/1/2017
212448/1/201710/1/2017

I hope its possible. Help appreciated!

12 Replies
Anonymous
Not applicable

This works as well:


tmp_table1:

LOAD * INLINE [

    GR, RT, QID, CD, Date

    1, 8, 11, 6/1/2017, 8/1/2017

    1, 10, 22, 9/1/2017, 8/1/2017

    1, 15, 33, 15/1/2017, 8/1/2017

    2, 9, 66, 4/1/2017, 10/1/2017

    2, 12, 44, 8/1/2017, 10/1/2017

    2, 15, 55, 11/1/2017, 10/1/2017

];

NoConcatenate

table1:

load *

Resident tmp_table1

where Date>CD and Date<Peek(CD,RecNo(),'tmp_table1');

DROP Table tmp_table1;

Capture2.PNG

antoniotiman
Master III
Master III

Maybe Your variable Date Format setting in Script.

See Attachment.

arpitkharkia
Creator III
Creator III
Author

Yeah thats what. Thank you so much for the help!