I need to find the name of the common records which have similar fields in them. For Example - I will create a vf page to dynamically take 3 fields for an object.
And I need an Soql Query to search for duplicate records in all the 3 fields together and must retrn the names of records which have the common (Same) values for all those fields. Note - I need to get only the name of the records. Please help. My query is - " This is a Dynamic query "
string SoqlStr=' SELECT ' + Field1 + ' , ' + Field2 + ' , ' + Field3 + ' , ' + ' COUNT(ID) ' +
' FROM Account GROUP BY ' + Field1 + ' , ' + Field2 + ' , ' + Field3 +
' HAVING COUNT(Field1) >= 1 AND COUNT(Field2) >= 1 AND COUNT(Field3) >= 1 ';
This is my basic built query . Please help me to transform it. The object is a standard object.