function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
salesforce@14salesforce@14 

Based on query

Hi,

How to check the new record values with all old records in same object using query in before insert operation.

Thanks.
SonamSonam (Salesforce Developers) 
1)You need to write an SOQL to first retrive all the existing records and put them in a list
2)Using a for loop, iterrate in the list comparing each element(record) with the one you are trying to enter.