Author: Benchwarmer
Posted: Wed Feb 22, 2017 3:41 am (GMT 5.5)
The ultimate goal of establishing this logic is to assign unique ID based on specified rules and it becomes failure in this case.
Apologies for that, Record ID is unique to each record.
Even if I prioritize the rules, it is not going to help since the record 1 from previous post does not match for unique number '008' until the record 2 is going to be processed first. I considered using some sort sequence and I don't think it is going to help either.
If you need more info, please let me know.
Posted: Wed Feb 22, 2017 3:41 am (GMT 5.5)
| Quote: |
| According to your 3 rules, yes record 2 matches both -- so why do you think it should only match record 8? |
The ultimate goal of establishing this logic is to assign unique ID based on specified rules and it becomes failure in this case.
| Quote: |
Since you did not post any of the logic you are using, how can we help you? Are the rules prioritized? |
Apologies for that, Record ID is unique to each record.
| Code: |
| WS-DATE = '2017-01-01' WS-FLAG = 'Y' SELECT UNIQUE_ID FROM RECORD_TABLE INNER JOIN UNIQUE_ID_TABLE B ON A.RECORD_ID = B.RECORD_ID WHERE (A.DATE = WS-DATE --> Rule 1 OR (YEAR(DATE) = YEAR(WS-DATE) AND (MONTH(DATE) = MONTH(WS-DATE) OR DAY(DATE) = DAY(WS-DATE)) AND A.FLAG = WS-FLAG) --> Rule 2 OR (YEAR(DATE) BETWEEN YEAR(WS-DATE) - 1 AND YEAR(WS-DATE) + 1 AND (MONTH(DATE) = MONTH(WS-DATE) AND DAY(DATE) = DAY(WS-DATE)) AND A.FLAG = WS-FLAG)) --> Rule 3 |
Even if I prioritize the rules, it is not going to help since the record 1 from previous post does not match for unique number '008' until the record 2 is going to be processed first. I considered using some sort sequence and I don't think it is going to help either.
If you need more info, please let me know.