Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [query]

A query is an inquiry into the database using the SELECT statement. A query is used to extract data from the database in a readable format according to the user's request.

0
votes
2answers
10 views

How can I use a SOQL query to get the number of AccountTeamMembers on an account?

I can write something like this to give me the AccountTeamMembers on all accounts select Id, (SELECT Id, AccountId FROM AccountTeamMembers) From Account but I don't know how to just get the count of ...
0
votes
0answers
14 views

Journey Query showing error: An unmatched parenthesis occurs in the query

I have this following query to extract click information on Journey and its ema : select j.JourneyName, j.VersionNumber, ja.ActivityName as 'EmailName', s.EventDate as 'ClickTime', su.EmailAddress, ...
-4
votes
3answers
54 views

how to create dynamic query [on hold]

List<Opportunity> opps = [ SELECT Id ,Name ,Amount ,CloseDate ,Stagename ,Near_to_Close_Date__c ...
0
votes
2answers
31 views

No results when querying _Click data view in Marketing Cloud

I'm trying to query the _Click data view and return a SubscriberKey for every user that clicked a link in a particular email. I've try several different ways to get at this and none are returning any ...
1
vote
0answers
28 views

Will connecting PowerBI to Salesforce hit the SOQL query limits? [closed]

Will connecting PowerBI to Salesforce hit the SOQL query limits? I don't find this in the documentation. EDIT2: If I connect to approximately 6 of 2000 objects in my enterprise salesforce ...
0
votes
0answers
18 views

Comparing certain fields in two separate instances of the same object under a parent object

Certification SObject is the parent of Exam SObject. A certification instance can belong only to one Contact. A Certification can have multiple Exams(eg: exam_types - Science, Maths, English ...
1
vote
2answers
28 views

Got error while constructing the dynamic query

I was trying to build a query to pass it in the QueryLocator. The following is the code snippet I tried to generate the dynamic query, public String buildQueryString(Object_Rule__mdt ObjectRule, ...
0
votes
1answer
16 views

Write to LIST from a DATA EXTENSION

I am trying to pull subscriber information from a Data Extension, and then add it into a custom list. I understand that the ideal process is to create a data extract, then import the CSV into the ...
6
votes
2answers
206 views

Not all records returned in SOQL Query

I have a query that I'm using to export data: SELECT c.Id, c.SystemModstamp, ... FROM Contact c WHERE c.SystemModstamp > start AND c.SystemModstamp < end AND c.Id > string ORDER BY c.Id ASC ...
0
votes
1answer
47 views

Too Many SOQL Queries error

I am coming into this problem in my debug logs. But when I'm reviewing the logs I am only seeing individual reads of SOQL query counts from various apps such as : Number of SOQL queries: 5 out of ...
1
vote
1answer
54 views

I am querying more than 2000 records. Is it a good idea to use the BULK API?

I'm new to the Salesforce community, so I apologize if this question is asked wrong. I was running into essentially the exact same problem mentioned in this post. Basically, I have a query that ...
1
vote
3answers
69 views

SQL multiple WHERE clause problem

I have a SQL query that puts records from one DE to another DE if that record does not exists in the second DE. The base works fine for me and i have the following query: select t.Emailaddress from [...
0
votes
1answer
37 views

Is it possible to write a SQL Query to extract send data that includes Tags and/or Campaign names

We are trying to do some reporting based on emails with specific tags or associated to specific campaigns over the past 12 months. I have tired to use the Analytics builder > Reports to get the data ...
0
votes
0answers
8 views

Trying to query the _open and click tables to fill a new table with the email of the users who have opened or clicked a link in an email

I'd like a query to pull from a specific email which is in content builder. What would my query look like? Also what columns are needed for the target Data Extension?
0
votes
0answers
17 views

Pulling every email job an email address has ever received

I am looking to pull all the email jobs that a particular email address has received. The issue is our transactional unit uses email as a the subscriber key and our promotional unit uses unique ...
0
votes
1answer
22 views

How does joining two custom objects into one custom object through master-detail relationship work

I've been working on a test method but I've had a problem creating the setup of it. public static List<Job_Posting__c> createPostings(){ List<Job_Posting__c> testPostings = new ...
0
votes
1answer
25 views

How to add 'LIMIT :' to String in Database.query?

I have Database.query that sorts records by a few filters (or any filter). I want to set the limit for it. How should a write it? return Database.query('SELECT Id, Name FROM Stereo_System__c' + ...
0
votes
0answers
10 views

Query using Click Data View to update a Data Extension

Currently I'm trying to create a query that will update a data extension field based on clicks on a series of emails (that go to the same url) My success agent suggested using the Click Data View, ...
0
votes
0answers
17 views

Update Journey Builder Entry Event by querying Decision Split data

I want to query the contact that went down a specific path in a decision split and get all of those contacts so that I can take them out of the entry event that fire's a journey builder. I will need ...
1
vote
1answer
28 views

Notes & Attachments Cant find using soql

I did not get any result from querying notes and attachment. Setup I create a custom object. I added notes and attachment to the custom object I created soql that filter by parentId and it looks like ...
0
votes
1answer
71 views

Malformed Query

UPDATE: Changed query from dynamic to static. Still have malformed problem. I have a malformed query problem. Could somebody help? It works in my batch class, but not my normal class. [...
1
vote
2answers
67 views

Select Knowledge object in SOQL query

I'm trying to get all articles which are published and online. In my user I turned on all permission set and so one to have access to Knowledge. List<Knowledge__kav> myList= [SELECT Id, ...
0
votes
0answers
6 views

Not able to query the data from heroku

I have imported my salesforce contact object data to heroku using heroku connect. I have also used heroku postgres addon for database. I have done this in php and have deployed the app to heroku ...
0
votes
1answer
29 views

Can I query Salesforce Queue and can I do it using the metadata or tooling APIs?

Can I query Salesforce Queue and can I do it using the metadata or tooling APIs? Looking to quickly access this data from Salesforce inspector, also looking to see if there is a way to check if a ...
0
votes
1answer
27 views

How to query pending server-call actions made from Lightning Controller?

I've been searching through the documentation but I couldn't find anything explaining how to query pending server-call actions made from my lightning component controller. I can debug using the ...
0
votes
1answer
43 views

Simple query troubleshooting

I have a simple query that is erring out. I cannot figure out why, as it is so simple. The target data extension has a primary key on contact_key. Both fields (unsubscribe & newsletter) from ...
0
votes
1answer
33 views

Query Activity for suscribers that opened campaigns

We want to get a Data Extension with only de emails of subscribers that opened certain JobIDs. I ran this SQL Activity but the targeted Data Extension shows 0 records after it finished running. What ...
2
votes
2answers
157 views

is it possible to put a list directly in a SOQL query?

Is it possible to put a list directly in a SOQL query form the query editor? Let's say I wanted to query over a list, is the following possible in any way? SELECT Id, Email FROM Contact WHERE ...
2
votes
1answer
28 views

How can I correctly convert List<SObjectField> into a list of comma-separated field names to build a SOQL String?

I've created a generic selector class as follows: public inherited sharing class DAO_SObjectSelector { public List<SObject> selectFor(Query query) { return Database.query(query.toString()); ...
0
votes
1answer
27 views

Extracting Open counts from Data Views and match against Salesforce Account ID's

I would like to extract my Opens into a statistics table that contains columns like Last Opened 7 Days. To achieve this I am using the Data Views to query out the _opens table. The target Data ...
0
votes
1answer
24 views

Difference between lock row and Record Currently Unavailable

Good day everyone, Last time,I encounter this error saying : UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record. I try to search a possible fix and I found that adding 'For ...
-2
votes
2answers
81 views

List size isnt working as expected for partner user

I have observed very weired nature in Lists result. I run this query in query editor: select id, Title, Description, FileType,FeaturedContentDate,FeaturedContentBoost,ContentDocumentId,TagCsv from ...
1
vote
1answer
31 views

Num of download option in contentversion query

Querying Top contents: select id, Title, Description, FileType,FeaturedContentDate,FeaturedContentBoost, Owner.Name, VersionNumber, ContentDocumentId,TagCsv from ContentVersion where ...
1
vote
1answer
22 views

Calculated field in SQL not inserting to Data Extension properly

I'm trying to calculate open ratio for our subscribers by adding up the number of emails they have been sent, number of those emails they have opened and then finally trying to calculate the ratio by ...
1
vote
1answer
56 views

How to Query for logged in username [Python:SimpleSalesforce]?

Tried to do user=sf.query("SELECT Id, Name FROM User WHERE Id = :UserInfo.getUserId()" but getting error: content = [{u'errorCode': u'MALFORMED_QUERY', u'message': u'\nSELECT Id, Name from User ...
0
votes
0answers
23 views

How to access Salesforce tables from unix shell script?

I have requirement to retrieve Salesforce source table counts via unix shell script. This shell script can be called in Informatica workflow as command task. Can someone please provide me with sample ...
5
votes
2answers
134 views

Allow simultaneous writes to the same Data Extension

I have a use case where I need to bring _PushAddress data from 60 Business Units back to the Global Business Unit. For information _PushAddress has a restricted view of data available in a single ...
0
votes
1answer
21 views

apex query error with local variable

This my query : Date todayDate = date.today(); PropositionCommerciales = [SELECT Id, Compte__c.Id AccountId, ...
0
votes
1answer
33 views

Extending WHERE clause with condition from another query

I have two different queries which give the results, however is there a way to combine 2 queries and extend the WHERE clause as below: Query 1 SELECT Id, Name, (Select ID, Name, Object_C__r.Name ...
0
votes
1answer
15 views

Default external access Setting Issue for site Guest user

If I query this record I will get one record Query Editor & Anonymous window select id,Name from Account where Name='TestPartner' but In coding, system.debug('company domain---->'...
2
votes
1answer
39 views

Querying top & featured content in salesforce Library

How to query top and featured contents in salesforce Library. I checked in documention but I didnt find anything https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/...
0
votes
1answer
41 views

UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record during Insert

Good day Everyone, I know there are lots of questions which is similar with my question. But I still post this because I did not find any case which is similar with mine. I am working with some ...
-2
votes
1answer
40 views

Write an aggregate query to return the sum of Closed Won opportunities for the current year (Close Date = THIS YEAR) grouped by the account [closed]

AggregateResult[] groupedResults = [SELECT AVG(Amount)aver FROM Opportunity]; Object avgAmount = groupedResults[0].get('aver');
0
votes
1answer
36 views

Retrieve data on a single query

I need to retrieve an object's info from a single query. Lets say I have 4 objects (A__c, B__c, C__c, D__c). The relationship is that B__c has the master-detail relationship with A__c and B__c is also ...
0
votes
2answers
59 views

Very basic _click query not working

I have a very basic _click query like this: SELECT SubscriberKey FROM _Click WHERE LinkName = 'XXX' OR LinkName = 'XXX' OR LinkName = 'XXX' The XXX are ofcourse dummy text but in my query i have ...
7
votes
2answers
92 views

Throwing System.QueryException on Batch Class for field “IsArchived” on Product2

We're using Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap()to fetch all the fields in Product2 and build a dynamic query. When the string is used in database.query() method, ...
0
votes
1answer
39 views

Can't Query All Fields in AllSubscribers List

I need to grab fields within the AllSubscribers list. I attempted a simple query, but I'm getting the error "Invalid column name..." for the columns that I've commented out in the screenshot below. Is ...
0
votes
2answers
22 views

Combine and Query 2 Child object to a Parent Object

I was wondering can you combine 2 child objects to a parent object. SELECT SourceIp FROM LoginHistory WHERE UserId IN (SELECT Id FROM User) SELECT City FROM LoginGeo WHERE CreatedbyId (SELECT Id ...
0
votes
1answer
97 views

SQL Query Error - Violation of Primary Key constraint

I am trying to take my information from a Data Extension which contains new customer emails and put them in another Data Extension which severs as our companies master list. I am able to populate ...
0
votes
1answer
22 views

Bubbling up an Account hierarchy to capture top most Parent Id from query

Based on some of the answers I've browsed I think this might involve 2 queries. I feel like this is probably a pretty common problem so I was hoping someone would have a quick answer or at least be ...