Activity Forums Salesforce® Discussions how to use wildcards for Soql in salesforce?

  • how to use wildcards for Soql in salesforce?

    Posted by Vikas Kumar on January 4, 2017 at 1:35 pm

    Hi,

    I don't understand about wildcards:

    Please can you explain me ( with example of words)

    1 Select id from Account where Name LIKE ' %Dir%'

    2 Select id from Account where Name LIKE ' Dir%'

    3 Select id from Account where Name LIKE ' Dir_%'

    thanks

    Kumar replied 8 years, 1 month ago 2 Members · 1 Reply
  • 1 Reply
  • Kumar

    Member
    January 5, 2017 at 8:47 am

    Hi Vikas,

    The % and _ wildcards are supported for the LIKE operator.

    • The % wildcard matches zero or more characters.
    • The _ wildcard matches exactly one character.

    For example in your case, if the accounts in your org have the following names:

    {Direct, ReDirector, UnDirects, UnDir, Dir}

    The first query returns: Direct, ReDirector, UnDirects, UnDir

    The second query returns: Direct, Dir

    The third query returns: Direct

    Hope this helps.

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos