AnsweredAssumed Answered

How do pull this recordset out of Salesforce?

Question asked by cathryn.crane207763 on Sep 26, 2017
Latest reply on Sep 28, 2017 by james_m_hutton098090

Hi all


Seems like this should be easy enough but I can't figure out how to do this in a Salesforce connection


Currently, we replicate the Salesforce database down to a SQL server.  I'm trying not to pull from SQL and pull directly from Salesforce.


This is the query:

WITH cte_opp AS (

   SELECT Account_Name__c, 
   CASE Invoice_Recipient__c WHEN 'Account/Customer' THEN AccountId
   WHEN 'Partner/Third Party Agent' THEN Partner_Account__c
   END as ID
   FROM [dbo].[Opportunity] o

   WHERE CreatedDate > '1/1/2017'


SELECT a.ID, a.GP_Customer_ID__c FROM dbo.Account a JOIN 

cte_opp on a.ID= cte_opp.ID




How would I generate a recordset so I can insert into another database?


And, another item is the Createdate actually needs to be a param that is dynamic and is based off the last time it ran.


Thanks all for your help