Questions tagged [where]

The syntax of the condition expression in a WHERE clause of a SOQL query includes one or more field expressions. You can specify multiple field expressions to a condition expression by using logical operators.

Filter by
Sorted by
Tagged with
0 votes
2 answers
875 views

Error in conversion bigint to varchar SQL

I am getting error SQL Errors occurred while processing retrieved data: Error converting data type varchar to bigint. This my Query and its come from the where clause. Anyone help me to resolve this ...
sThirumagal93's user avatar
0 votes
2 answers
101 views

How do I include a COUNT field in SQL with multiple joins?

I have a SQL where I want to pull in all Landlords with more than one Pending Request. The trouble I'm having is not knowing where to place the syntax that will populate the field called '...
Greg Beazley's user avatar
0 votes
1 answer
402 views

SOQL WHERE + Integer on Auto Number

I want to retrieve the first x records in my dataset. Logically, I created an Auto Number field, but it's acting like a string. Example: [SELECT id__c FROM Person__c WHERE id__c < '4'] incorrectly ...
Kenneth Hippolite's user avatar
1 vote
0 answers
3k views

How to get references of a standard field [closed]

I'm currently working on cleaning up the opportunity object and I'm facing an issue with getting the field references(Apex, Components, Workflow, Process Builder, Email templates, Reports) of complete ...
Pavan tej's user avatar
  • 1,439
0 votes
1 answer
781 views

Query based on field equal to field in another query

I have a custom object that has for name a string that matches the BillingPostalCode field from different Accounts objects. I'm querying some accounts, and now I want to limit a query of this custom ...
Santiago Barboza's user avatar
2 votes
2 answers
670 views

Is there a way to distinguish Long Text Area field or Rich Text Area field from a regular Text Area?

I need to build an interface to allow a user to filter record by the field chosen by the user. I know that I can use Text Area fields in the WHERE Clause but I can't use Long Text Area field or Rich ...
Patlatus's user avatar
  • 16k
0 votes
1 answer
207 views

Select related object based on priority field

I have two sobjects PriorityCase__c (Person__c(master-detail to Person__c), Priority__c) and Person__c (name). And I want to select Person__c with the highest Priority__c. The highest priority is 1. ...
Zalivada's user avatar
0 votes
1 answer
243 views

Query apex controller Where into a string

I am not a developer but I am trying to modify this controller that is available in a component I installed via app exchange. For what i understood the code is just converting this query into a string ...
Brian23Gt's user avatar
  • 109
-2 votes
1 answer
1k views

Dynamic SOQL with multiple conditions and undefined amount of variables

I have SOQL like this: [SELECT id FROM CONTACT where lastName =:lastName AND firstName = :firstName] But what to do if there are only lastName variable? What if there are 3 variables or more? I ...
Nistelarti's user avatar
0 votes
1 answer
721 views

How can I make a SOQL which selects Leads filtered by a Converted Account Field not being true?

We have a requirement, after leads are converted, we are sending data to a partner about them. We have a batch process which will periodically look for newly converted leads, send the data to the ...
Brian Kessler's user avatar
2 votes
1 answer
5k views

How to filter on CreatedDate using a date range in SOQL?

I'm having problems trying to filter a query by CreatedDate using a date range. The query returns always a wrong set of records. For example, if I want to get all records created until 2020-07-28, it ...
Emmanuel_M's user avatar
1 vote
0 answers
298 views

Tooling API SOQL Where clause not working for certain fields

I'm working in the developer console using the tooling api to write a query against permission sets. This query works: select Name, Label, Description, ManageableState, NamespacePrefix, Type from ...
Mike Jones's user avatar
0 votes
1 answer
4k views

How to pass set<id> dynamically to soql [duplicate]

I have a dynamic Soql in which I want to pass a set. I get an error: System.QueryException: expecting a colon, found '{' Anonymous window Set<Id> idSet = new Set<Id> (); idSet.add('...
Thomas's user avatar
  • 2,294
4 votes
1 answer
236 views

SOQL Count of non-blank multi-select fields

I'm trying to find out how many people answered a multi-select question in a survey. For this count I do not need to know what they picked, simply that they picked something (or didn't not pick ...
GreenMyrtle's user avatar
1 vote
2 answers
2k views

Unable to use Less-than/greater-than with Datetime in SOQL condition

I am unable to use a Datetime field in a SOQL query: SELECT Status FROM Campaign WHERE LastModifiedDate >= Last_Sync__c; I have a workaround where I create a checkbox formula field which is true ...
Pranav Chitrans's user avatar
0 votes
2 answers
1k views

Jsforce where clause having multiple conditions not working

This below code results in INVALID_FIELD: Test' AND ParentId = null AND EndDate > '2019-05-21' LIMIT 1 error.. How can I add more than one condition in where clasue? const a = 2019-01-03 const b = ...
il0v3d0g's user avatar
  • 137
7 votes
2 answers
7k views

SOQL: Populate a Literal List in WHERE IN Clause

I need to query for an object based on 2 string variables. The first one is a constant but the second one gets passed to the class constructor. So in the end I want to achieve something like this: ...
Arthlete's user avatar
  • 4,857
0 votes
2 answers
129 views

SOQL WHERE IN query

Which of these is better: object__c[] objects = [SELECT name FROM object__c WHERE opportunity__c IN (SELECT OpportunityId From OpportunityLineItem WHERE Product2.Family = 'My Item')]; or: ...
Mark's user avatar
  • 414
0 votes
1 answer
2k views

Datetime in WHERE clause

I am facing issue with Datetime column in WHERE clause. Below two queries are giving different counts. SELECT COUNT(CallTime_c) FROM SF...TableName WHERE CallDateTime > '09-13-2018 09:01:00' and ...
Mahesh's user avatar
  • 1
2 votes
3 answers
244 views

Check field's data availability in WHERE clause

Can we make a check on WHERE clause of a SOQL query for comparing 2 date fields availability? My requirement is, I want to get the response from query based on data availability on two different ...
Salesforce Learner's user avatar
0 votes
3 answers
2k views

SOQL - Use the size of the list of inner child query in the WHERE clause

I was trying something like along those lines but it's not working: SELECT Id ( SELECT Id FROM Orders WHERE Custom_Field__c = '...
Arthlete's user avatar
  • 4,857