Index: /trunk/ippTools/share/magicdstool_getrunids.sql
===================================================================
--- /trunk/ippTools/share/magicdstool_getrunids.sql	(revision 20846)
+++ /trunk/ippTools/share/magicdstool_getrunids.sql	(revision 20846)
@@ -0,0 +1,16 @@
+-- find the inputs for a new magicDSRun from an existing magicRun
+SELECT DISTINCT
+    magic_id,
+    magicRun.exp_id,
+    chip_id,
+    cam_id,
+    warp_id 
+FROM magicRun 
+JOIN magicInputSkyfile USING(magic_id)
+JOIN diffInputSkyfile USING(diff_id)
+JOIN warpRun USING(warp_id)
+JOIN fakeRun USING(fake_id)
+JOIN camRun USING(cam_id)
+JOIN chipRun USING(chip_id)
+WHERE template  = 0
+AND magic_id = %ld
