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
eswar R 1eswar R 1 

In one of the object there are two fields called Field1 and Filed2 exist and we have 100,000 records, out of 70,000 record values are equal in field1 and field2. Now Display those 70,000 records on visualforce page.

LBKLBK
SOQL cannot be used for Field to Field comparison directly.

Easy way is to create a formula field to do the comparison and set a boolean value.

You can use the formula in your SOQL query.

Your SOQL query will look like this.
 
SELECT Id, Name, field1__c, field2__c FROM Object1__c WHERE Field_Compare__c = true
Field_Compare__c will be your formula field which returns true (a boolean output) if field1 = field 2, it will return false if field1 <> field2.

Hope this helps.
 
Vinuthh SVinuthh S
Hi Eswar 

SELECT Id, Name, field1__c, field2__c FROM Object1__c WHERE field1__c = field2__c;

Use this query and display it in VF Page.

Thanks 
Vinuthh S