What is a SOQL like query?
I am trying to make a query that will search for accounts with a name similar or exactly matching a field value.
So for example I have "Sales-Force" in the field. There is an account called "Salesforce" or "Sales Force"
My current query
Select Id, Name FROM Account WHERE Name LIKE '%Sales-Force%'
This isn't returning my accounts named "Sales Force" or "Salesforce" in my query editor.
UPDATED * My Apex code
string accountName= record.Name;
if(accountName.contains('-'))
{
accountName = accountName.replace('-', '%');
}
if(accountName.contains(' '))
{
accountName = accountName.replace(' ', '%');
}
accountName= '%' + accountName+ '%';
ListaccountLookup = new List accountLookup = [Select Id, Name FROM Account WHERE Name LIKE :accountName];();