Index: trunk/ippTools/share/Makefile.am
===================================================================
--- trunk/ippTools/share/Makefile.am	(revision 27975)
+++ trunk/ippTools/share/Makefile.am	(revision 27982)
@@ -198,4 +198,5 @@
      magictool_rawimfile.sql \
      magictool_revertnode.sql \
+     magictool_exposure.sql \
      magicdstool_clearstatefaults.sql \
      magicdstool_completed_runs.sql \
Index: trunk/ippTools/share/magictool_exposure.sql
===================================================================
--- trunk/ippTools/share/magictool_exposure.sql	(revision 27982)
+++ trunk/ippTools/share/magictool_exposure.sql	(revision 27982)
@@ -0,0 +1,54 @@
+SELECT *
+FROM (
+    -- Forward diff
+    SELECT DISTINCT
+        magicRun.magic_id,
+        rawExp.*,
+        camProcessedExp.path_base,
+        camProcessedExp.zpt_obs,
+        camProcessedExp.zpt_stdev,
+        camProcessedExp.fwhm_major,
+        camProcessedExp.fwhm_minor,
+        camProcessedExp.iq_m2,
+        camProcessedExp.iq_m3,
+        camProcessedExp.iq_m4
+    FROM
+        magicRun
+    JOIN diffRun USING(diff_id)
+    JOIN diffInputSkyfile USING(diff_id)
+    LEFT JOIN warpRun
+        ON warpRun.warp_id = diffInputSkyfile.warp1
+        AND magicRun.inverse = 0
+    JOIN fakeRun USING(fake_id)
+    JOIN camRun USING(cam_id)
+    JOIN camProcessedExp USING(cam_id)
+    JOIN chipRun USING(chip_id,exp_id)
+    JOIN rawExp USING(exp_id)
+    -- WHERE hook %s
+    UNION
+    -- Backward diff
+    SELECT DISTINCT
+        magicRun.magic_id,
+        rawExp.*,
+        camProcessedExp.path_base,
+        camProcessedExp.zpt_obs,
+        camProcessedExp.zpt_stdev,
+        camProcessedExp.fwhm_major,
+        camProcessedExp.fwhm_minor,
+        camProcessedExp.iq_m2,
+        camProcessedExp.iq_m3,
+        camProcessedExp.iq_m4
+    FROM
+        magicRun
+    JOIN diffRun USING(diff_id)
+    JOIN diffInputSkyfile USING(diff_id)
+    LEFT JOIN warpRun
+        ON warpRun.warp_id = diffInputSkyfile.warp2
+        AND magicRun.inverse = 1
+    JOIN fakeRun USING(fake_id)
+    JOIN camRun USING(cam_id)
+    JOIN camProcessedExp USING(cam_id)
+    JOIN chipRun USING(chip_id,exp_id)
+    JOIN rawExp USING(exp_id)
+    -- WHERE hook %s
+) AS magicExposures
Index: trunk/ippTools/share/magictool_inputs.sql
===================================================================
--- trunk/ippTools/share/magictool_inputs.sql	(revision 27975)
+++ trunk/ippTools/share/magictool_inputs.sql	(revision 27982)
@@ -2,4 +2,5 @@
 SELECT
     magicRun.magic_id,
+    magicRun.exp_id,
     magicRun.inverse, -- Using the inverse subtraction?
     magicRun.diff_id,
@@ -10,5 +11,6 @@
     magicInputs.warp_path_base, -- path_base for the template warp (if any)
     magicInputs.stack_path_base, -- path_base for the template stack (if any)
-    magicInputs.magic_path_base -- path_base for child nodes (if any)
+    magicInputs.magic_path_base, -- path_base for child nodes (if any)
+    magicInputs.cam_path_base -- path_base for the input camera
 FROM magicRun
 JOIN (
