A few versions ago, ServiceNow added the ability in filters to query for records where one field was “the same as” another field…

ServiceNow allows you to query for records where one field is the same as another
I’ve occasionally wondered if I could accomplish the same thing in a GlideRecord Query. A few weeks ago, a coworker had a dire need for this functionality, so we experimented and figured it out:
gr.addQuery(‘sys_updated_on’, “SAMEAS”, “sys_created_on”);