Index: trunk/ippTools/share/difftool_inputskyfile.sql
===================================================================
--- trunk/ippTools/share/difftool_inputskyfile.sql	(revision 14031)
+++ trunk/ippTools/share/difftool_inputskyfile.sql	(revision 14254)
@@ -1,4 +1,10 @@
-SELECT DISTINCT
-    warpSkyfile.*,
+SELECT 
+    diffRun.diff_id,
+    diffRun.skycell_id,
+    diffRun.tess_id,
+    NULL as stack_id,
+    warpSkyfile.warp_id,
+    warpSkyfile.uri,
+    warpSkyfile.path_base,
     diffInputSkyfile.template,
     rawExp.camera
@@ -22,3 +28,33 @@
 WHERE
     diffRun.state = 'run'
+UNION
+SELECT 
+    diffRun.diff_id,
+    diffRun.skycell_id,
+    diffRun.tess_id,
+    stackSumSkyfile.stack_id,
+    NULL as warp_id,
+    stackSumSkyfile.uri,
+    stackSumSkyfile.path_base,
+    diffInputSkyfile.template,
+    rawExp.camera
+FROM diffRun
+JOIN diffInputSkyfile
+    USING(diff_id)
+JOIN stackSumSkyfile
+    ON  diffInputSkyfile.stack_id = stackSumSkyfile.stack_id
+JOIN stackInputSkyfile
+    ON diffInputSkyfile.stack_id = stackInputSkyfile.stack_id
+JOIN warpInputExp
+    ON stackInputSkyfile.warp_id = warpInputExp.warp_id
+JOIN camProcessedExp
+    ON warpInputExp.cam_id = camProcessedExp.cam_id
+JOIN chipRun
+    ON camProcessedExp.chip_id = chipRun.chip_id
+JOIN chipProcessedImfile
+    ON chipRun.chip_id = chipProcessedImfile.chip_id
+JOIN rawExp
+    ON chipProcessedImfile.exp_id = rawExp.exp_id
+WHERE
+    diffRun.state = 'run'
 
