Hopefully will get some help here :
I've some validations written in trigger , which fires during update. An example is - Updated records shouldn't have intermingling 'dates'(start date and end dates) with each other and also with any already existing records
Ex : record 1 has start date and end date as : 1st jan - 31st jan record 2 : 2nd feb - 29th feb ( mutually exclusive as of now) then I can't update dates in both of them with following dates for example : record 1 : 10 jan - 10th feb record 2 : 20 th jan - 20th march
As start date of 2nd record is being updated with date, which happens to be in-between, start date and end date of first record. So error should occur
Now When trigger fires, it successfully check overlapping dates with 'ALREADY' existing records and Prevent update but if same lot(records which are being updated together, as shown in example above) contains such dates- then trigger fails to check or validates this and succesfully update records without any error, which is problem for me
Any suggestions, how I can put such validations. Trigger code is little complex so not posting here .