Query for records which have the city length > 20

SELECT Id FROM User WHERE (NOT Username LIKE '___')

The above SOQL query will return all user rows where the username is not 3 characters.

SELECT Id FROM User WHERE Username LIKE '______'

The above SOQL query will return all user rows where the username is 5 characters.


You need to create a new formula filed of type NUMBER and insert a simple formula to it that calculates a length of the string:

LEN(Street__c)

LEN Formula

Then you can query on this field:

Select ... From ...  Where FormulaField___c > 20

Tags:

Soql