Jump to content

Archived

This topic is now archived and is closed to further replies.

  • 0
WillJennings

Sql Insert Into Statement

Question

I was wondering if it is possible to insert the result of a calculated field back into the data table I'm using as a data source with the SQL INSERT INTO function?  I'm using SQL to create a SUM within the calculated field already.  This is what I have and it works:

 

SELECT


SUM (CASE
    
       WHEN  [@field:ReturnMaster_File_Type] = 'Federal' AND


             [@field:ReturnMaster_ACCEPTED] <= '2/15/2015' AND


             [@field:ReturnMaster_Sent] = '' THEN     


             [@field:InfusionsoftCustomers_a2014_Fed_EF_Fee]


       WHEN  [@field:ReturnMaster_File_Type] = 'State'  AND


             [@field:ReturnMaster_ACCEPTED] <= '2/15/2015' AND


             [@field:ReturnMaster_Sent] = ''THEN 


             [@field:InfusionsoftCustomers_a2014_State_EF_Fee]


       ELSE 0


END) FROM _v_BillingView where ReturnMaster_EFIN = target.[@field:ReturnMaster_EFIN]




I'm not super familiar with SQL but I was thinking it might be possible.  I was trying something like this:




INSERT INTO BillingView (InfusionsoftCustomers_AmountBilled2)


VALUES


(SELECT


SUM (CASE
    
       WHEN  [@field:ReturnMaster_File_Type] = 'Federal' AND


             [@field:ReturnMaster_ACCEPTED] <= '2/15/2015' AND


             [@field:ReturnMaster_Sent] = '' THEN     


             [@field:InfusionsoftCustomers_a2014_Fed_EF_Fee]


       WHEN  [@field:ReturnMaster_File_Type] = 'State'  AND


             [@field:ReturnMaster_ACCEPTED] <= '2/15/2015' AND


             [@field:ReturnMaster_Sent] = ''THEN 


             [@field:InfusionsoftCustomers_a2014_State_EF_Fee]


       ELSE 0


END) FROM _v_BillingView where ReturnMaster_EFIN = target.[@field:ReturnMaster_EFIN])
 
Of course this comes back as Invalid.  Since I'm not familiar with SQL I wasn't sure if my syntax was wrong or if it just ins't possible within Caspio.  Any insight would be greatly appreciated.

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts


×
×
  • Create New...