troubleshooting Question

Mass Upload Load a table directly from a cfquery result set.

Avatar of mahpog
mahpog asked on
Web Development Software
2 Comments1 Solution217 ViewsLast Modified:
I have a cfquery result set that I would like to directly update an existing table.

I would like to do this in coldfusion.  Do I output to hidden fields, add an index and then do a cfloop update command?  - Or is there a better way.



<cfquery name="qdirect" Datasource="#Request.datasource#">
SELECT psid,
SUM(CASE labor_date WHEN '01/01/2007' THEN labor_hours ELSE 0 END) AS jan_salary,
SUM(CASE labor_date WHEN '02/01/2007' THEN labor_hours ELSE 0 END) AS feb_salary,
SUM(CASE labor_date WHEN '03/01/2007' THEN labor_hours ELSE 0 END) AS mar_salary,
SUM(CASE labor_date WHEN '04/01/2007' THEN labor_hours ELSE 0 END) AS apr_salary,
SUM(CASE labor_date WHEN '05/01/2007' THEN labor_hours ELSE 0 END) AS may_salary,
SUM(CASE labor_date WHEN '06/01/2007' THEN labor_hours ELSE 0 END) AS jun_salary,
SUM(CASE WHEN (d_i IN ('D','I')
            and proj_def in ('##')
            and activity_type like 'D%'
            and rcc NOT in ('80507'))
      THEN labor_hours ELSE 0 END ) as oTotal
 FROM a_rollup_labor
 GROUP BY psid
 ORDER BY psid
</cfquery>
************


Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros