Index: /trunk/ippTools/share/stacktool_sumskyfile.sql
===================================================================
--- /trunk/ippTools/share/stacktool_sumskyfile.sql	(revision 19275)
+++ /trunk/ippTools/share/stacktool_sumskyfile.sql	(revision 19276)
@@ -6,8 +6,8 @@
 JOIN stackSumSkyfile
     USING(stack_id)
+JOIN stackInputSkyfile
+    USING(stack_id)
 JOIN warpRun
-    -- just need 1 warp to find the camera
-    ON warpRun.warp_id = (SELECT warp_id FROM stackInputSkyfile 
-                            WHERE stackInputSkyfile.stack_id = stackRun.stack_id limit 1)
+    USING(warp_id)
 JOIN fakeRun
     ON warpRun.fake_id = fakeRun.fake_id
@@ -18,6 +18,2 @@
 JOIN rawExp
     ON chipRun.exp_id  = rawExp.exp_id
-WHERE
--- bogus test; just here so there there is a 'WHERE' stmt to append conditionals too
--- XXX EAM : this is not needed : fix the stacktool code.
-    stackRun.stack_id is NOT NULL
Index: /trunk/ippTools/src/stacktool.c
===================================================================
--- /trunk/ippTools/src/stacktool.c	(revision 19275)
+++ /trunk/ippTools/src/stacktool.c	(revision 19276)
@@ -749,5 +749,5 @@
     if (psListLength(where->list)) {
         psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
-        psStringAppend(&query, " AND %s", whereClause);
+        psStringAppend(&query, " WHERE %s", whereClause);
         psFree(whereClause);
     }
