I want to check (from the same table) if there is an association between the two events based on date-time.
One set of data has the ending date-time of certain events, and the other set of data has the starting date-time for other events.
If the first event gets completed before the second event then I want to link them up.
What I am having so far is:
SELECT name as name_A, date-time as end_DTS, id as id_A
FROM tableA WHERE criteria = 1
SELECT name as name_B, date-time as start_DTS, id as id_B
FROM tableA WHERE criteria = 2
Then I join them:
SELECT name_A, name_B, id_A, id_B,
if(start_DTS > end_DTS,'VALID','') as validation_check
FROM tableA
LEFT JOIN tableB ON name_A = name_B
So based on my validation_check field, can I then run an UPDATE query with the SELECT nested?