Index: /trunk/ippMonitor/def/addRunProcessed.d
===================================================================
--- /trunk/ippMonitor/def/addRunProcessed.d	(revision 40881)
+++ /trunk/ippMonitor/def/addRunProcessed.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE addRun, addProcessedExp
+TABLE addRun JOIN addProcessedExp USING (add_id)
 TITLE Processed addRuns
 FILE  addRunProcessed.php
@@ -5,6 +5,4 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-
-WHERE addRun.add_id = addProcessedExp.add_id
 
 #     field                   size  format  name         show    link to                  extras
Index: /trunk/ippMonitor/def/camIQstats.d
===================================================================
--- /trunk/ippMonitor/def/camIQstats.d	(revision 40881)
+++ /trunk/ippMonitor/def/camIQstats.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, chipRun, rawExp, camProcessedExp
+TABLE camRun JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE Per-Exposure Image Quality Stats
 FILE  camIQstats.php
@@ -6,11 +6,8 @@
 # limit this table to non-OBJECT types of images
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id  = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
-RESTRICT_COUNT AND dateobs >= CURDATE()
-UNRESTRICTED AND dateobs >= CURDATE()
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/camPendingExp.d
===================================================================
--- /trunk/ippMonitor/def/camPendingExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/camPendingExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, chipRun, rawExp
+TABLE camRun JOIN chipRun using (chip_id) JOIN rawExp using (exp_id)
 TITLE Camera Pending
 FILE  camPendingExp.php
@@ -5,6 +5,7 @@
 
 WHERE camRun.state = 'new'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/camProcessedExp.d
===================================================================
--- /trunk/ippMonitor/def/camProcessedExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/camProcessedExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, camProcessedExp, chipRun, rawExp
+TABLE camRun JOIN camProcessedExp using (cam_id) JOIN chipRun using (chip_id) JOIN rawExp using (exp_id)
 TITLE Camera Processed
 FILE  camProcessedExp.php
@@ -6,11 +6,8 @@
 # the following WHERE clauses are added to all queries joined by AND
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id  = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
-RESTRICT_COUNT AND dateobs >= CURDATE()
-UNRESTRICTED AND dateobs >= CURDATE()
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 # define the arguments supplied to the links below (if any)
Index: /trunk/ippMonitor/def/camProcessedExp_Images.d
===================================================================
--- /trunk/ippMonitor/def/camProcessedExp_Images.d	(revision 40881)
+++ /trunk/ippMonitor/def/camProcessedExp_Images.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, camProcessedExp, chipRun, rawExp
+TABLE camRun JOIN camProcessedExp using (cam_id) JOIN chipRun using (chip_id) JOIN rawExp using (exp_id)
 TITLE Camera Processed
 FILE  camProcessedExp_Images.php
@@ -6,11 +6,8 @@
 # the following WHERE clauses are added to all queries joined by AND
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id  = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
-RESTRICT_COUNT AND dateobs >= CURDATE()
-UNRESTRICTED AND dateobs >= CURDATE()
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 # define image names to be used below
Index: /trunk/ippMonitor/def/camProcessedExp_NoImages.d
===================================================================
--- /trunk/ippMonitor/def/camProcessedExp_NoImages.d	(revision 40881)
+++ /trunk/ippMonitor/def/camProcessedExp_NoImages.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, camProcessedExp, chipRun, rawExp
+TABLE camRun JOIN camProcessedExp using (cam_id) JOIN chipRun using (chip_id) JOIN rawExp using (exp_id)
 TITLE Camera Processed (No Images)
 FILE  camProcessedExp_NoImages.php
@@ -6,11 +6,8 @@
 # the following WHERE clauses are added to all queries joined by AND
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id  = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
-RESTRICT_COUNT AND dateobs >= CURDATE()
-UNRESTRICTED AND dateobs >= CURDATE()
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 # define the arguments supplied to the links below (if any)
Index: /trunk/ippMonitor/def/camProcessedExp_failure.d
===================================================================
--- /trunk/ippMonitor/def/camProcessedExp_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/camProcessedExp_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, camProcessedExp, chipRun, rawExp
+TABLE camRun JOIN camProcessedExp using (cam_id) JOIN chipRun using (chip_id) JOIN rawExp using (exp_id)
 TITLE Camera Failed Exposures
 FILE  camProcessedExp_failure.php
@@ -5,8 +5,8 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id  = camRun.cam_id
 WHERE camProcessedExp.fault != 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 # define the arguments supplied to the links below (if any)
Index: /trunk/ippMonitor/def/camProcessedImfile.d
===================================================================
--- /trunk/ippMonitor/def/camProcessedImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/camProcessedImfile.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, camProcessedExp, chipRun, rawExp, chipProcessedImfile
+TABLE camRun JOIN camProcessedExp using (cam_id) JOIN chipRun using (chip_id) JOIN rawExp using (exp_id) JOIN chipProcessedImfile using (chip_id) 
 TITLE Camera Processed Imfiles
 FILE  camProcessedImfile.php
@@ -6,11 +6,7 @@
 # the following WHERE clauses are added to all queries joined by AND
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id = camRun.cam_id
-WHERE chipProcessedImfile.chip_id = camRun.chip_id
 
-RESTRICT_COUNT AND dateobs >= CURDATE()
-UNRESTRICTED AND dateobs >= CURDATE()
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/camStageExp.d
===================================================================
--- /trunk/ippMonitor/def/camStageExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/camStageExp.d	(revision 40882)
@@ -1,12 +1,9 @@
-TABLE camRun, chipRun, rawExp
+TABLE camRun JOIN chipRun using (chip_id) JOIN rawExp using (exp_id)
 TITLE Camera Stage Exposures
 FILE  camStageExp.php
 MENU  ipp.science.dat
 
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-
-RESTRICT_COUNT AND dateobs >= CURDATE()
-UNRESTRICTED AND dateobs >= CURDATE()
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/chipIQstats.d
===================================================================
--- /trunk/ippMonitor/def/chipIQstats.d	(revision 40881)
+++ /trunk/ippMonitor/def/chipIQstats.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE chipRun, rawExp, chipProcessedImfile
+TABLE chipRun JOIN rawExp USING (exp_id) JOIN chipProcessedImfile using (chip_id)
 TITLE Per-Chip Image Quality Stats
 FILE  chipIQstats.php
@@ -6,9 +6,7 @@
 # limit this table to non-OBJECT types of images
 WHERE chipRun.state = 'full'
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE chipRun.chip_id = chipProcessedImfile.chip_id
 
-RESTRICT_COUNT AND dateobs >= CURDATE()
-UNRESTRICTED AND dateobs >= CURDATE()
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/chipPendingExp.d
===================================================================
--- /trunk/ippMonitor/def/chipPendingExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/chipPendingExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE chipRun, rawExp
+TABLE chipRun JOIN rawExp using (exp_id)
 TITLE chip Pending Exposures
 FILE  chipPendingExp.php
@@ -6,5 +6,7 @@
 # limit this table to non-OBJECT types of images
 WHERE chipRun.state = 'new'
-WHERE chipRun.exp_id = rawExp.exp_id
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/chipPendingImfile.d
===================================================================
--- /trunk/ippMonitor/def/chipPendingImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/chipPendingImfile.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE chipRun, rawExp, rawImfile
+TABLE chipRun JOIN rawExp using (exp_id) JOIN rawImfile using (exp_id)
 TITLE Chip Pending Imfiles
 FILE  chipPendingImfile.php
@@ -9,6 +9,7 @@
 # limit this table to OBJECT types of images
 WHERE chipRun.state = 'new'
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE rawImfile.exp_id = rawExp.exp_id
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1 rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/chipProcessedExp.d
===================================================================
--- /trunk/ippMonitor/def/chipProcessedExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/chipProcessedExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE chipRun, rawExp
+TABLE chipRun JOIN rawExp using (exp_id)
 TITLE chip Processed Exposures
 FILE  chipProcessedExp.php
@@ -6,8 +6,7 @@
 # limit this table to non-OBJECT types of images
 WHERE chipRun.state != 'new'
-WHERE chipRun.exp_id = rawExp.exp_id
 
-RESTRICT_COUNT AND dateobs >= CURDATE()
-UNRESTRICTED AND dateobs >= CURDATE()
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/chipProcessedImfile.d
===================================================================
--- /trunk/ippMonitor/def/chipProcessedImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/chipProcessedImfile.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE chipRun, rawExp, chipProcessedImfile
+TABLE chipRun JOIN rawExp using (exp_id) JOIN chipProcessedImfile using (chip_id)
 TITLE chip Processed Imfile
 FILE  chipProcessedImfile.php
@@ -5,11 +5,8 @@
 
 # limit this table to non-OBJECT types of images
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE chipProcessedImfile.exp_id = chipRun.exp_id
-WHERE chipProcessedImfile.chip_id = chipRun.chip_id
 WHERE chipProcessedImfile.fault = 0
 
-RESTRICT_COUNT AND dateobs >= CURDATE()
-UNRESTRICTED AND dateobs >= CURDATE()
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 #UNRESTRICTED WHERE 0=1
Index: /trunk/ippMonitor/def/chipProcessedImfile_failure.d
===================================================================
--- /trunk/ippMonitor/def/chipProcessedImfile_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/chipProcessedImfile_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE chipRun, rawExp, chipProcessedImfile
+TABLE chipRun JOIN rawExp using (exp_id) JOIN chipProcessedImfile using (chip_id)
 TITLE Chip Failed Imfiles
 FILE  chipProcessedImfile_failure.php
@@ -5,8 +5,8 @@
 
 # limit this table to non-OBJECT types of images
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE chipProcessedImfile.exp_id = chipRun.exp_id
-WHERE chipProcessedImfile.chip_id = chipRun.chip_id
 WHERE chipProcessedImfile.fault != 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1 rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/chipStageExp.d
===================================================================
--- /trunk/ippMonitor/def/chipStageExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/chipStageExp.d	(revision 40882)
@@ -1,11 +1,9 @@
-TABLE chipRun, rawExp
+TABLE chipRun JOIN rawExp using (exp_id)
 TITLE Chip Stage Exposures
 FILE  chipStageExp.php
 MENU  ipp.science.dat
 
-WHERE chipRun.exp_id = rawExp.exp_id
-
-RESTRICT_COUNT AND dateobs >= CURDATE()
-UNRESTRICTED AND dateobs >= CURDATE()
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/detInputExp.d
===================================================================
--- /trunk/ippMonitor/def/detInputExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/detInputExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detInputExp, rawExp
+TABLE detInputExp JOIN rawExp USING (exp_id)
 TITLE detInputExp
 FILE  detInputExp.php
@@ -5,5 +5,7 @@
 
 # limit this table to non-OBJECT types of images
-WHERE detInputExp.exp_id = rawExp.exp_id
+
+RESTRICT_COUNT WHERE dateobs >= CURDATE()
+UNRESTRICTED WHERE dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$detInputExp.exp_id
Index: /trunk/ippMonitor/def/detNormalizedExp.d
===================================================================
--- /trunk/ippMonitor/def/detNormalizedExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/detNormalizedExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detNormalizedExp, detRun
+TABLE detNormalizedExp JOIN detRun USING (det_id)
 TITLE detNormalizedExp
 FILE  detNormalizedExp.php
@@ -5,5 +5,4 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detNormalizedExp.det_id    = detRun.det_id
 # WHERE detNormalizedExp.iteration = detRun.iteration
 
Index: /trunk/ippMonitor/def/detNormalizedExp_failure.d
===================================================================
--- /trunk/ippMonitor/def/detNormalizedExp_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/detNormalizedExp_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detNormalizedExp, detRun
+TABLE detNormalizedExp JOIN detRun USING (det_id)
 TITLE detNormalizedExp Failures
 FILE  detNormalizedExp_failure.php
@@ -5,5 +5,4 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detNormalizedExp.det_id = detRun.det_id
 WHERE detNormalizedExp.fault  > 0
 
Index: /trunk/ippMonitor/def/detNormalizedImfile.d
===================================================================
--- /trunk/ippMonitor/def/detNormalizedImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/detNormalizedImfile.d	(revision 40882)
@@ -1,8 +1,6 @@
-TABLE detNormalizedImfile, detRun
+TABLE detNormalizedImfile JOIN detRun USING (det_id)
 TITLE detNormalizedImfile
 FILE  detNormalizedImfile.php
 MENU  ipp.imfiles.dat
-
-WHERE detNormalizedImfile.det_id = detRun.det_id
 
 ARGS  ARG1 detNormalizedImfile.det_id=$detNormalizedImfile.det_id
Index: /trunk/ippMonitor/def/detProcessedExp.d
===================================================================
--- /trunk/ippMonitor/def/detProcessedExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/detProcessedExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detProcessedExp, rawExp
+TABLE detProcessedExp JOIN rawExp USING (exp_id)
 TITLE detProcessedExp
 FILE  detProcessedExp.php
@@ -5,5 +5,7 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detProcessedExp.exp_id = rawExp.exp_id
+
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 # define image names to be used below
Index: /trunk/ippMonitor/def/detProcessedExp_failure.d
===================================================================
--- /trunk/ippMonitor/def/detProcessedExp_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/detProcessedExp_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detProcessedExp, rawExp
+TABLE detProcessedExp JOIN rawExp USING (exp_id)
 TITLE detProcessedExp Failures
 FILE  detProcessedExp_failure.php
@@ -5,6 +5,8 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detProcessedExp.exp_id = rawExp.exp_id
 WHERE detProcessedExp.fault > 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1 detProcessedImfile.det_id=$detProcessedExp.det_id
Index: /trunk/ippMonitor/def/detProcessedExp_noimage.d
===================================================================
--- /trunk/ippMonitor/def/detProcessedExp_noimage.d	(revision 40881)
+++ /trunk/ippMonitor/def/detProcessedExp_noimage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detProcessedExp, rawExp
+TABLE detProcessedExp JOIN rawExp USING (exp_id)
 TITLE detProcessedExp
 FILE  detProcessedExp_noimage.php
@@ -5,5 +5,7 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detProcessedExp.exp_id = rawExp.exp_id
+
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 # define image names to be used below
Index: /trunk/ippMonitor/def/detProcessedImfile.d
===================================================================
--- /trunk/ippMonitor/def/detProcessedImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/detProcessedImfile.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detProcessedImfile, rawExp
+TABLE detProcessedImfile JOIN rawExp USING (exp_id)
 TITLE detProcessedImfile
 FILE  detProcessedImfile.php
@@ -5,5 +5,7 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detProcessedImfile.exp_id = rawExp.exp_id
+
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 #     field                          size  format  name      show   link to     extras
Index: /trunk/ippMonitor/def/detProcessedImfile_failure.d
===================================================================
--- /trunk/ippMonitor/def/detProcessedImfile_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/detProcessedImfile_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detProcessedImfile, rawExp, rawImfile
+TABLE detProcessedImfile JOIN rawExp USING (exp_id) JOIN rawImfile USING (exp_id)
 TITLE detProcessedImfile Failures
 FILE  detProcessedImfile_failure.php
@@ -5,8 +5,9 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detProcessedImfile.exp_id = rawExp.exp_id
-WHERE detProcessedImfile.exp_id = rawImfile.exp_id
 WHERE detProcessedImfile.class_id = rawImfile.class_id
 WHERE detProcessedImfile.fault > 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1 detProcessedImfile.det_id=$detProcessedImfile.det_id
Index: /trunk/ippMonitor/def/detRegisteredImfile.d
===================================================================
--- /trunk/ippMonitor/def/detRegisteredImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/detRegisteredImfile.d	(revision 40882)
@@ -1,8 +1,6 @@
-TABLE detRegisteredImfile, detRun
+TABLE detRegisteredImfile JOIN detRun USING (det_id)
 TITLE detRegisteredImfile
 FILE  detRegisteredImfile.php
 MENU  ipp.imfiles.dat
-
-WHERE detRegisteredImfile.det_id = detRun.det_id
 
 ARGS  ARG1 detRegisteredImfile.det_id=$detRegisteredImfile.det_id
Index: /trunk/ippMonitor/def/detResidExp.d
===================================================================
--- /trunk/ippMonitor/def/detResidExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/detResidExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detResidExp, rawExp, detInputExp
+TABLE detResidExp JOIN rawExp USING (exp_id) JOIN detInputExp USING (det_id)
 TITLE detResidExp
 FILE  detResidExp.php
@@ -5,8 +5,9 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detResidExp.exp_id = rawExp.exp_id
-WHERE detResidExp.det_id = detInputExp.det_id
 WHERE detResidExp.exp_id = detInputExp.exp_id
 WHERE detResidExp.iteration = detInputExp.iteration
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 # define image names to be used below
Index: /trunk/ippMonitor/def/detResidExp_failure.d
===================================================================
--- /trunk/ippMonitor/def/detResidExp_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/detResidExp_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detResidExp, rawExp, detInputExp
+TABLE detResidExp JOIN rawExp USING (exp_id) JOIN detInputExp USING (exp_id)
 TITLE detResidExp Failures
 FILE  detResidExp_failure.php
@@ -5,8 +5,9 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detResidExp.exp_id = rawExp.exp_id
-WHERE detResidExp.exp_id = detInputExp.exp_id
 WHERE detResidExp.iteration = detInputExp.iteration
 WHERE detResidExp.fault > 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 # define the arguments supplied to the links below (if any)
Index: /trunk/ippMonitor/def/detResidExp_noimage.d
===================================================================
--- /trunk/ippMonitor/def/detResidExp_noimage.d	(revision 40881)
+++ /trunk/ippMonitor/def/detResidExp_noimage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detResidExp, rawExp, detInputExp
+TABLE detResidExp JOIN rawExp USING (exp_id) JOIN detInputExp USING (exp_id)
 TITLE detResidExp
 FILE  detResidExp_noimage.php
@@ -5,7 +5,8 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detResidExp.exp_id = rawExp.exp_id
-WHERE detResidExp.exp_id = detInputExp.exp_id
 WHERE detResidExp.iteration = detInputExp.iteration
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 # define image names to be used below
Index: /trunk/ippMonitor/def/detResidImfile.d
===================================================================
--- /trunk/ippMonitor/def/detResidImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/detResidImfile.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detResidImfile, rawImfile
+TABLE detResidImfile JOIN rawImfile USING (exp_id)
 TITLE detResidImfile
 FILE  detResidImfile.php
@@ -5,5 +5,4 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detResidImfile.exp_id = rawImfile.exp_id
 WHERE detResidImfile.class_id = rawImfile.class_id
 
Index: /trunk/ippMonitor/def/detResidImfile_failure.d
===================================================================
--- /trunk/ippMonitor/def/detResidImfile_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/detResidImfile_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detResidImfile, rawExp, rawImfile
+TABLE detResidImfile JOIN rawExp USING (exp_id) JOIN rawImfile USING (exp_id)
 TITLE detResidImfile Failures
 FILE  detResidImfile_failure.php
@@ -5,8 +5,9 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE detResidImfile.exp_id = rawExp.exp_id
-WHERE detResidImfile.exp_id = rawImfile.exp_id
 WHERE detResidImfile.class_id = rawImfile.class_id
 WHERE detResidImfile.fault > 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1 detResidImfile.det_id=$detResidImfile.det_id
Index: /trunk/ippMonitor/def/detRunActive.d
===================================================================
--- /trunk/ippMonitor/def/detRunActive.d	(revision 40881)
+++ /trunk/ippMonitor/def/detRunActive.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detRun LEFT JOIN detRunSummary using(det_id) 
+TABLE detRun LEFT JOIN detRunSummary using (det_id) 
 TITLE Active Detrend Runs
 FILE  detRunActive.php
Index: /trunk/ippMonitor/def/detRunSummary.d
===================================================================
--- /trunk/ippMonitor/def/detRunSummary.d	(revision 40881)
+++ /trunk/ippMonitor/def/detRunSummary.d	(revision 40882)
@@ -1,8 +1,6 @@
-TABLE detRunSummary, detRun
+TABLE detRunSummary JOIN detRun USING (det_id)
 TITLE Detrend Run Iterations (does not list registered frames)
 FILE  detRunSummary.php
 MENU  ipp.detrend.dat
-
-WHERE detRunSummary.det_id = detRun.det_id
 
 ARGS  ARG1  detInputExp.det_id=$detRunSummary.det_id
Index: /trunk/ippMonitor/def/detStackedImfile.d
===================================================================
--- /trunk/ippMonitor/def/detStackedImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/detStackedImfile.d	(revision 40882)
@@ -1,8 +1,6 @@
-TABLE detStackedImfile, detRun
+TABLE detStackedImfile JOIN detRun USING (det_id)
 TITLE detStackedImfile
 FILE  detStackedImfile.php
 MENU  ipp.imfiles.dat
-
-WHERE detStackedImfile.det_id = detRun.det_id
 
 # XXX change uri to path_base in db
Index: /trunk/ippMonitor/def/detStackedImfile_failure.d
===================================================================
--- /trunk/ippMonitor/def/detStackedImfile_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/detStackedImfile_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE detStackedImfile, detRun
+TABLE detStackedImfile JOIN detRun USING (det_id)
 TITLE detStackedImfile Failures
 FILE  detStackedImfile_failure.php
@@ -5,5 +5,4 @@
 
 WHERE fault > 0
-WHERE detStackedImfile.det_id = detRun.det_id
 
 ARGS  ARG1 detStackedImfile.det_id    =$detStackedImfile.det_id
Index: /trunk/ippMonitor/def/diffFailedSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/diffFailedSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/diffFailedSkyfile.d	(revision 40882)
@@ -1,8 +1,7 @@
-TABLE diffRun, diffSkyfile
+TABLE diffRun JOIN diffSkyfile USING (diff_id)
 TITLE Diff Failed Skyfiles
 FILE  diffFailedSkyfile.php
 MENU  ipp.stack.dat
 
-WHERE diffRun.diff_id             = diffSkyfile.diff_id
 WHERE diffSkyfile.fault != 0
 
Index: /trunk/ippMonitor/def/diffInputSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/diffInputSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/diffInputSkyfile.d	(revision 40882)
@@ -1,11 +1,6 @@
-TABLE diffInputSkyfile, diffRun
+TABLE diffInputSkyfile JOIN diffRun USING (diff_id)
 TITLE diffInputSkyfile
 FILE  diffInputSkyfile.php
 MENU  ipp.stack.dat
-
-WHERE diffInputSkyfile.diff_id = diffRun.diff_id
-
-RESTRICT_COUNT AND 0 = 1
-UNRESTRICTED AND 0 = 1
 
 #        field                            size format  name           show     link to         extras
Index: /trunk/ippMonitor/def/diffProcessedSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/diffProcessedSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/diffProcessedSkyfile.d	(revision 40882)
@@ -1,13 +1,9 @@
-TABLE diffRun, diffSkyfile
+TABLE diffRun JOIN diffSkyfile USING (diff_id)
 TITLE Diff Processed Skyfiles
 FILE  diffProcessedSkyfile.php
 MENU  ipp.stack.dat
 
-WHERE diffRun.diff_id             = diffSkyfile.diff_id
 # WHERE diffRun.state = 'full'
 # WHERE diffSkyfile.fault = 0
-
-RESTRICT_COUNT AND 0 = 1
-UNRESTRICTED AND 0 = 1
 
 ARGS  ARG7 diffSkyfile.diff_id=$diffSkyfile.diff_id
Index: /trunk/ippMonitor/def/diffProcessedSkyfile_Images.d
===================================================================
--- /trunk/ippMonitor/def/diffProcessedSkyfile_Images.d	(revision 40881)
+++ /trunk/ippMonitor/def/diffProcessedSkyfile_Images.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE diffRun, diffSkyfile
+TABLE diffRun JOIN diffSkyfile USING (diff_id)
 TITLE Diff Processed Skyfiles
 FILE  diffProcessedSkyfile_Images.php
@@ -7,8 +7,4 @@
 #UNRESTRICTED AND dateobs >= CURDATE()
 
-UNRESTRICTED AND 0>1
-RESTRICT_COUNT AND 0>1
-
-WHERE diffRun.diff_id             = diffSkyfile.diff_id
 # WHERE diffRun.state = 'full'
 # WHERE diffSkyfile.fault = 0
Index: /trunk/ippMonitor/def/diffSummary_Images.d
===================================================================
--- /trunk/ippMonitor/def/diffSummary_Images.d	(revision 40881)
+++ /trunk/ippMonitor/def/diffSummary_Images.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE diffRun, diffSkyfile, diffSummary
+TABLE diffRun JOIN diffSkyfile USING (diff_id) JOIN diffSummary USING (diff_id)
 TITLE Diff Summary w/ Images
 FILE  diffSummary_Images.php
@@ -6,6 +6,4 @@
 UNRESTRICTED AND 0>1
 
-WHERE diffRun.diff_id             = diffSkyfile.diff_id
-WHERE diffSummary.diff_id = diffRun.diff_id
 # WHERE diffRun.state = 'full'
 # WHERE diffSkyfile.fault = 0
Index: /trunk/ippMonitor/def/distRun.d
===================================================================
--- /trunk/ippMonitor/def/distRun.d	(revision 40881)
+++ /trunk/ippMonitor/def/distRun.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE distRun, distComponent
+TABLE distRun JOIN distComponent USING (dist_id)
 TITLE Distribution Runs
 FILE  distRun.php
@@ -6,7 +6,6 @@
 # the following WHERE clauses are added to all queries joined by AND
 
-WHERE distRun.dist_id = distComponent.dist_id
-UNRESTRICTED AND 0=1
-RESTRICT_COUNT AND 0>1
+UNRESTRICTED WHERE distRun.time_stamp >= CURDATE()
+RESTRICT_COUNT WHERE distRun.time_stamp >= CURDATE()
 
 #     field                   size  format  name         show    link to                  extras
Index: /trunk/ippMonitor/def/failedCamProcessedExp.d
===================================================================
--- /trunk/ippMonitor/def/failedCamProcessedExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/failedCamProcessedExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, camProcessedExp, chipRun, rawExp
+TABLE camRun JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE Camera Failed Exposures
 FILE  failedCamProcessedExp.php
@@ -5,8 +5,8 @@
 
 # the following WHERE clauses are added to all queries joined by AND
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id  = camRun.cam_id
 WHERE camProcessedExp.fault != 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 # define the arguments supplied to the links below (if any)
Index: /trunk/ippMonitor/def/failedChipProcessedImfile.d
===================================================================
--- /trunk/ippMonitor/def/failedChipProcessedImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/failedChipProcessedImfile.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE chipRun, rawExp, chipProcessedImfile
+TABLE chipRun JOIN rawExp USING (exp_id) JOIN chipProcessedImfile USING (chip_id)
 TITLE Chip Failed Imfiles
 FILE  failedChipProcessedImfile.php
@@ -6,7 +6,8 @@
 # limit this table to non-OBJECT types of images
 WHERE chipRun.exp_id = rawExp.exp_id
-WHERE chipProcessedImfile.exp_id = chipRun.exp_id
-WHERE chipProcessedImfile.chip_id = chipRun.chip_id
 WHERE chipProcessedImfile.fault != 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1 rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/failedDiffSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/failedDiffSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/failedDiffSkyfile.d	(revision 40882)
@@ -1,8 +1,7 @@
-TABLE diffRun, diffSkyfile
+TABLE diffRun JOIN diffSkyfile USING (diff_id)
 TITLE Diff Failed Skyfiles
 FILE  failedDiffSkyfile.php
 MENU  ipp.stack.dat
 
-WHERE diffRun.diff_id             = diffSkyfile.diff_id
 WHERE diffSkyfile.fault != 0
 
Index: /trunk/ippMonitor/def/failedFakeProcessedImfile.d
===================================================================
--- /trunk/ippMonitor/def/failedFakeProcessedImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/failedFakeProcessedImfile.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE fakeRun, fakeProcessedImfile, camRun, chipRun, rawExp
+TABLE fakeRun JOIN fakeProcessedImfile USING (fake_id) JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE fake Processed Imfile
 FILE  failedFakeProcessedImfile.php
@@ -5,9 +5,8 @@
 
 # limit this table to non-OBJECT types of images
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE fakeProcessedImfile.fake_id = fakeRun.fake_id
 WHERE fakeProcessedImfile.fault != 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/failedFullForceSkyfiles.d
===================================================================
--- /trunk/ippMonitor/def/failedFullForceSkyfiles.d	(revision 40881)
+++ /trunk/ippMonitor/def/failedFullForceSkyfiles.d	(revision 40882)
@@ -1,8 +1,7 @@
-TABLE fullForceResult, fullForceRun
+TABLE fullForceResult JOIN fullForceRun USING (ff_id)
 TITLE FullForce Failed Skyfiles
 FILE  failedFullForceSkyfiles.php
 MENU  ipp.science.dat
 
-WHERE fullForceResult.ff_id = fullForceRun.ff_id
 WHERE fullForceResult.fault != 0
 
Index: /trunk/ippMonitor/def/failedStackSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/failedStackSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/failedStackSkyfile.d	(revision 40882)
@@ -1,8 +1,7 @@
-TABLE stackRun, stackSumSkyfile
+TABLE stackRun JOIN stackSumSkyfile USING (stack_id)
 TITLE Stack Failed Skyfiles
 FILE  failedStackSkyfile.php
 MENU  ipp.stack.dat
 
-WHERE stackRun.stack_id = stackSumSkyfile.stack_id
 WHERE stackSumSkyfile.fault != 0
 
Index: /trunk/ippMonitor/def/failedStaticsky.d
===================================================================
--- /trunk/ippMonitor/def/failedStaticsky.d	(revision 40881)
+++ /trunk/ippMonitor/def/failedStaticsky.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE staticskyRun JOIN staticskyResult USING(sky_id) JOIN staticskyInput USING(sky_id) JOIN stackRun USING(stack_id)
+TABLE staticskyRun JOIN staticskyResult USING (sky_id) JOIN staticskyInput USING (sky_id) JOIN stackRun USING (stack_id)
 TITLE Static Sky Failed
 FILE  failedStaticsky.php
Index: /trunk/ippMonitor/def/failedWarpSkyfiles.d
===================================================================
--- /trunk/ippMonitor/def/failedWarpSkyfiles.d	(revision 40881)
+++ /trunk/ippMonitor/def/failedWarpSkyfiles.d	(revision 40882)
@@ -1,13 +1,11 @@
-TABLE warpSkyfile, warpRun, fakeRun, camRun, chipRun, rawExp
+TABLE warpSkyfile JOIN warpRun USING (warp_id) JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE Warp Failed Skyfiles
 FILE  failedWarpSkyfiles.php
 MENU  ipp.science.dat
 
-WHERE warpSkyfile.warp_id = warpRun.warp_id
-WHERE warpRun.fake_id = fakeRun.fake_id
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
 WHERE warpSkyfile.fault != 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/fakePendingExp.d
===================================================================
--- /trunk/ippMonitor/def/fakePendingExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/fakePendingExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE fakeRun, camRun, chipRun, rawExp
+TABLE fakeRun JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE fake Pending Exposures
 FILE  fakePendingExp.php
@@ -6,7 +6,7 @@
 # limit this table to non-OBJECT types of images
 WHERE fakeRun.state = 'new'
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/fakePendingImfile.d
===================================================================
--- /trunk/ippMonitor/def/fakePendingImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/fakePendingImfile.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE fakeRun, camRun, chipRun, rawExp, rawImfile
+TABLE fakeRun JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN rawImfile USING (exp_id)
 TITLE Fake Pending Imfiles
 FILE  fakePendingImfile.php
@@ -5,8 +5,7 @@
 
 WHERE fakeRun.state = 'new'
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE rawImfile.exp_id = rawExp.exp_id
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1 rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/fakeProcessedExp.d
===================================================================
--- /trunk/ippMonitor/def/fakeProcessedExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/fakeProcessedExp.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE fakeRun, camRun, chipRun, rawExp
+TABLE fakeRun JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE fake Processed Exposures
 FILE  fakeProcessedExp.php
@@ -6,7 +6,7 @@
 # limit this table to non-OBJECT types of images
 WHERE fakeRun.state != 'new'
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/fakeProcessedImfile.d
===================================================================
--- /trunk/ippMonitor/def/fakeProcessedImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/fakeProcessedImfile.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE fakeRun, fakeProcessedImfile, camRun, chipRun, rawExp
+TABLE fakeRun JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN fakeProcessedImfile USING (fake_id)
 TITLE fake Processed Imfile
 FILE  fakeProcessedImfile.php
@@ -5,9 +5,8 @@
 
 # limit this table to non-OBJECT types of images
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE fakeProcessedImfile.fake_id = fakeRun.fake_id
 WHERE fakeProcessedImfile.fault = 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/fakeProcessedImfile_failure.d
===================================================================
--- /trunk/ippMonitor/def/fakeProcessedImfile_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/fakeProcessedImfile_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE fakeRun, fakeProcessedImfile, camRun, chipRun, rawExp
+TABLE fakeRun JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN fakeProcessedImfile USING (fake_id)
 TITLE fake Processed Imfile
 FILE  fakeProcessedImfile_failure.php
@@ -5,9 +5,8 @@
 
 # limit this table to non-OBJECT types of images
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE fakeProcessedImfile.fake_id = fakeRun.fake_id
 WHERE fakeProcessedImfile.fault != 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/fakeStageExp.d
===================================================================
--- /trunk/ippMonitor/def/fakeStageExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/fakeStageExp.d	(revision 40882)
@@ -1,10 +1,9 @@
-TABLE fakeRun, camRun, chipRun, rawExp
+TABLE fakeRun JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE Fake Stage Exposures
 FILE  fakeStageExp.php
 MENU  ipp.science.dat
 
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/flatcorrCamera.d
===================================================================
--- /trunk/ippMonitor/def/flatcorrCamera.d	(revision 40881)
+++ /trunk/ippMonitor/def/flatcorrCamera.d	(revision 40882)
@@ -1,11 +1,9 @@
-TABLE flatcorrCamLink, flatcorrRun, camRun, chipRun, rawExp
+TABLE flatcorrCamLink JOIN flatcorrRun USING (corr_id) JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE flatcorr Camera Runs
 FILE  flatcorrCamera.php
 MENU  ipp.detrend.dat
 
-WHERE flatcorrRun.corr_id = flatcorrCamLink.corr_id
-WHERE flatcorrCamLink.cam_id = camRun.cam_id
-WHERE flatcorrCamLink.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 OP   OP1  $rawExp.ra * 57.295783
Index: /trunk/ippMonitor/def/flatcorrChip.d
===================================================================
--- /trunk/ippMonitor/def/flatcorrChip.d	(revision 40881)
+++ /trunk/ippMonitor/def/flatcorrChip.d	(revision 40882)
@@ -1,10 +1,9 @@
-TABLE flatcorrChipLink, flatcorrRun, chipRun, rawExp
+TABLE flatcorrChipLink JOIN flatcorrRun USING (corr_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE flatcorr Chip Runs
 FILE  flatcorrChip.php
 MENU  ipp.detrend.dat
 
-WHERE flatcorrRun.corr_id = flatcorrChipLink.corr_id
-WHERE flatcorrChipLink.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 OP   OP1  $rawExp.ra * 57.295783
Index: /trunk/ippMonitor/def/fullforceFailedSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/fullforceFailedSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/fullforceFailedSkyfile.d	(revision 40882)
@@ -1,10 +1,7 @@
-TABLE fullForceInput, fullForceRun, warpRun, fullForceResult
+TABLE fullForceInput JOIN fullForceRun USING (ff_id) JOIN warpRun USING (warp_id) JOIN fullForceResult USING (ff_id)
 TITLE Full Force Failed 
 FILE  fullforceFailedSkyfile.php
 MENU  ipp.ffs.dat
 
-WHERE fullForceRun.ff_id = fullForceInput.ff_id
-WHERE fullForceInput.warp_id = warpRun.warp_id
-WHERE fullForceInput.ff_id = fullForceResult.ff_id
 WHERE fullForceResult.fault != 0
 
Index: /trunk/ippMonitor/def/fullforceProcessedSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/fullforceProcessedSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/fullforceProcessedSkyfile.d	(revision 40882)
@@ -1,10 +1,6 @@
-TABLE fullForceInput, fullForceRun, warpRun, fullForceResult
+TABLE fullForceInput JOIN fullForceRun USING (ff_id) JOIN warpRun USING (warp_id) JOIN fullForceResult USING (ff_id)
 TITLE Full Force Processed 
 FILE  fullforceProcessedSkyfile.php
 MENU  ipp.ffs.dat
-
-WHERE fullForceRun.ff_id = fullForceInput.ff_id
-WHERE fullForceInput.warp_id = warpRun.warp_id
-WHERE fullForceInput.ff_id = fullForceResult.ff_id
 
 #        field                          size  format  name           show     link to         extras
Index: /trunk/ippMonitor/def/fullforce_failure.d
===================================================================
--- /trunk/ippMonitor/def/fullforce_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/fullforce_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE staticskyRun JOIN staticskyResult USING(sky_id) JOIN staticskyInput USING(sky_id) JOIN stackRun USING(stack_id)
+TABLE staticskyRun JOIN staticskyResult USING (sky_id) JOIN staticskyInput USING (sky_id) JOIN stackRun USING (stack_id)
 TITLE Static Sky Failed (Log)
 FILE  failedStaticsky.php
Index: /trunk/ippMonitor/def/histogramBackgroundImage.d
===================================================================
--- /trunk/ippMonitor/def/histogramBackgroundImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/histogramBackgroundImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, chipRun, rawExp, camProcessedExp
+TABLE camRun JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN camProcessedExp USING (cam_id)
 TITLE New histogram background
 FILE  histogramBackgroundImage.php
@@ -5,7 +5,4 @@
 
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
Index: /trunk/ippMonitor/def/histogramCamProcessedExpImage.d
===================================================================
--- /trunk/ippMonitor/def/histogramCamProcessedExpImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/histogramCamProcessedExpImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, chipRun, rawExp, camProcessedExp
+TABLE camRun JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN camProcessedExp USING (cam_id)
 TITLE Histogram fwhm major (camProcessedExp)
 FILE  histogramCamProcessedExpImage.php
@@ -5,7 +5,4 @@
 
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
Index: /trunk/ippMonitor/def/histogramChipProcessedImfileFwhmMajorImage.d
===================================================================
--- /trunk/ippMonitor/def/histogramChipProcessedImfileFwhmMajorImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/histogramChipProcessedImfileFwhmMajorImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, chipRun, rawExp, camProcessedExp, chipProcessedImfile
+TABLE camRun JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN camProcessedExp USING (cam_id) JOIN chipProcessedImfile USING (chip_id)
 TITLE Histogram fwhm major (chipProcessedImfile)
 FILE  histogramChipProcessedImfileFwhmMajorImage.php
@@ -5,8 +5,4 @@
 
 WHERE camRun.state = 'full'
-WHERE chipProcessedImfile.exp_id = rawExp.exp_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE camProcessedExp.cam_id = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
Index: /trunk/ippMonitor/def/histogramChipRunFwhmMajorImage.d
===================================================================
--- /trunk/ippMonitor/def/histogramChipRunFwhmMajorImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/histogramChipRunFwhmMajorImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, chipRun, rawExp, camProcessedExp
+TABLE camRun JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN camProcessedExp USING (cam_id)
 TITLE Histogram fwhm major (camProcessedExp)
 FILE  histogramCamProcessedExpImage.php
@@ -5,7 +5,4 @@
 
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
Index: /trunk/ippMonitor/def/histogramFwhmMajorImage.d
===================================================================
--- /trunk/ippMonitor/def/histogramFwhmMajorImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/histogramFwhmMajorImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, chipRun, rawExp, camProcessedExp
+TABLE camRun JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN camProcessedExp USING (cam_id)
 TITLE New histogram fwhm major
 FILE  histogramFwhmMajorImage.php
@@ -5,7 +5,4 @@
 
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
Index: /trunk/ippMonitor/def/histogramFwhmMinorImage.d
===================================================================
--- /trunk/ippMonitor/def/histogramFwhmMinorImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/histogramFwhmMinorImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, chipRun, rawExp, camProcessedExp
+TABLE camRun JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN camProcessedExp USING (cam_id)
 TITLE New histogram fwhm minor
 FILE  histogramFwhmMinorImage.php
@@ -5,7 +5,4 @@
 
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
Index: /trunk/ippMonitor/def/histogramZptObsImage.d
===================================================================
--- /trunk/ippMonitor/def/histogramZptObsImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/histogramZptObsImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camRun, chipRun, rawExp, camProcessedExp
+TABLE camRun JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN camProcessedExp USING (cam_id)
 TITLE Histogram of ZptObs
 FILE  histogramZptObsImage.php
@@ -5,7 +5,4 @@
 
 WHERE camRun.state = 'full'
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camProcessedExp.cam_id = camRun.cam_id
 WHERE camProcessedExp.fault = 0
 
Index: /trunk/ippMonitor/def/maskStats.d
===================================================================
--- /trunk/ippMonitor/def/maskStats.d	(revision 40881)
+++ /trunk/ippMonitor/def/maskStats.d	(revision 40882)
@@ -1,11 +1,9 @@
-TABLE rawExp, chipRun, camRun, fakeRun, warpRun
+TABLE rawExp JOIN chipRun USING (exp_id) JOIN camRun USING (chip_id) JOIN fakeRun USING (cam_id) JOIN warpRun USING (fake_id)
 TITLE Mask Stats
 FILE  maskStats.php
 MENU  ipp.czar.dat
 
-WHERE rawExp.exp_id = chipRun.exp_id
-WHERE chipRun.chip_id = camRun.chip_id
-WHERE camRun.cam_id = fakeRun.cam_id
-WHERE fakeRun.fake_id = warpRun.fake_id
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 OP   OP1  $ra * 57.295783
Index: /trunk/ippMonitor/def/newImfile.d
===================================================================
--- /trunk/ippMonitor/def/newImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/newImfile.d	(revision 40882)
@@ -4,6 +4,4 @@
 MENU  ipp.load.dat
 
-UNRESTRICTED WHERE 0>1
-
 #        field       size  format  name           show   link to         extras
 FIELD    exp_id,	5, %d,     exposure ID
Index: /trunk/ippMonitor/def/newsimplePlotStaticskyImage.d
===================================================================
--- /trunk/ippMonitor/def/newsimplePlotStaticskyImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/newsimplePlotStaticskyImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE staticskyRun, staticskyInput, stackRun, skycell 
+TABLE staticskyRun JOIN staticskyInput USING (sky_id) JOIN stackRun USING (stack_id) JOIN skycell using (skycell_id)
 TITLE New sky plot - staticsky
 FILE  simplePlotStaticskyImage.php
@@ -5,7 +5,4 @@
 
 WHERE staticskyRun.state != 'new' 
-WHERE staticskyRun.sky_id = staticskyInput.sky_id
-WHERE staticskyInput.stack_id = stackRun.stack_id
-WHERE stackRun.skycell_id = skycell.skycell_id
 WHERE stackRun.tess_id = skycell.tess_id
 
Index: /trunk/ippMonitor/def/publishDone.d
===================================================================
--- /trunk/ippMonitor/def/publishDone.d	(revision 40881)
+++ /trunk/ippMonitor/def/publishDone.d	(revision 40882)
@@ -1,9 +1,6 @@
-TABLE publishRun, publishClient, publishDone
+TABLE publishRun JOIN publishClient USING (client_id) JOIN publishDone USING (pub_id)
 TITLE Publish Done
 FILE  publishDone.php
 MENU  ipp.dist.dat
-
-WHERE publishRun.client_id = publishClient.client_id
-WHERE publishRun.pub_id    = publishDone.pub_id
 
 ARGS ARG1 basename=$publishDone.path_base
Index: /trunk/ippMonitor/def/publishRun.d
===================================================================
--- /trunk/ippMonitor/def/publishRun.d	(revision 40881)
+++ /trunk/ippMonitor/def/publishRun.d	(revision 40882)
@@ -1,8 +1,6 @@
-TABLE publishRun, publishClient
+TABLE publishRun JOIN publishClient USING (client_id)
 TITLE Publish Runs
 FILE  publishRun.php
 MENU  ipp.dist.dat
-
-WHERE publishRun.client_id = publishClient.client_id
 
 #     field                   size  format  name         show    link to                  extras
Index: /trunk/ippMonitor/def/publishSummary.d
===================================================================
--- /trunk/ippMonitor/def/publishSummary.d	(revision 40881)
+++ /trunk/ippMonitor/def/publishSummary.d	(revision 40882)
@@ -1,8 +1,6 @@
-TABLE publishRun, publishClient
+TABLE publishRun JOIN publishClient USING (client_id)
 TITLE Publish Summary
 FILE  publishSummary.php
 MENU  ipp.dist.dat
-
-WHERE publishRun.client_id = publishClient.client_id
 
 #     field                   size  format  name         show    link to                  extras
Index: /trunk/ippMonitor/def/pzDoneImfile.d
===================================================================
--- /trunk/ippMonitor/def/pzDoneImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/pzDoneImfile.d	(revision 40882)
@@ -4,7 +4,5 @@
 MENU  ipp.load.dat
 
-UNRESTRICTED AND 0>1
-
-WHERE pzDownloadImfile.fault     = 0
+#WHERE pzDownloadImfile.fault     = 0
 
 #        field                       size 	format  name           show     link to         extras
Index: /trunk/ippMonitor/def/pzPendingImfile.d
===================================================================
--- /trunk/ippMonitor/def/pzPendingImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/pzPendingImfile.d	(revision 40882)
@@ -3,6 +3,4 @@
 FILE  pzPendingImfile.php
 MENU  ipp.load.dat
-
-UNRESTRICTED AND 0>1
 
 WHERE summitImfile.exp_name  = pzDownloadExp.exp_name 
Index: /trunk/ippMonitor/def/rawDetrendExp.d
===================================================================
--- /trunk/ippMonitor/def/rawDetrendExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/rawDetrendExp.d	(revision 40882)
@@ -6,4 +6,7 @@
 # limit this table to non-OBJECT types of images
 WHERE (rawExp.exp_type != 'OBJECT' and rawExp.exp_type != 'LIGHT')
+
+RESTRICT_COUNT AND dateobs >= CURDATE()
+UNRESTRICTED AND dateobs >= CURDATE()
 
 ARGS ARG1 exp_id=$exp_id
Index: /trunk/ippMonitor/def/rawDetrendExp_detrend.d
===================================================================
--- /trunk/ippMonitor/def/rawDetrendExp_detrend.d	(revision 40881)
+++ /trunk/ippMonitor/def/rawDetrendExp_detrend.d	(revision 40882)
@@ -6,4 +6,7 @@
 # limit this table to non-OBJECT types of images
 WHERE rawExp.exp_type != 'OBJECT'
+
+RESTRICT_COUNT AND dateobs >= CURDATE()
+UNRESTRICTED AND dateobs >= CURDATE()
 
 ARGS ARG1 rawImfile.exp_id=$exp_id
Index: /trunk/ippMonitor/def/rawExp.d
===================================================================
--- /trunk/ippMonitor/def/rawExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/rawExp.d	(revision 40882)
@@ -5,4 +5,7 @@
 
 ARGS ARG1 rawImfile.exp_id=$exp_id
+
+RESTRICT_COUNT WHERE dateobs >= CURDATE()
+UNRESTRICTED WHERE dateobs >= CURDATE()
 
 OP   OP1  $ra * 57.295783
Index: /trunk/ippMonitor/def/rawExpStats.d
===================================================================
--- /trunk/ippMonitor/def/rawExpStats.d	(revision 40881)
+++ /trunk/ippMonitor/def/rawExpStats.d	(revision 40882)
@@ -5,4 +5,7 @@
 
 ARGS ARG1 rawImfile.exp_id=$exp_id
+
+RESTRICT_COUNT WHERE dateobs >= CURDATE()
+UNRESTRICTED WHERE dateobs >= CURDATE()
 
 OP   OP1  $ra * 57.295783
Index: /trunk/ippMonitor/def/rawExp_failed.d
===================================================================
--- /trunk/ippMonitor/def/rawExp_failed.d	(revision 40881)
+++ /trunk/ippMonitor/def/rawExp_failed.d	(revision 40882)
@@ -7,4 +7,7 @@
 WHERE fault > 0
 WHERE rawExp.exp_type = 'OBJECT'
+
+RESTRICT_COUNT AND dateobs >= CURDATE()
+UNRESTRICTED AND dateobs >= CURDATE()
 
 ARGS ARG1 exp_id=$exp_id
Index: /trunk/ippMonitor/def/rawImfile.d
===================================================================
--- /trunk/ippMonitor/def/rawImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/rawImfile.d	(revision 40882)
@@ -2,9 +2,9 @@
 TITLE Raw Image File
 FILE  rawImfile.php
-MENU  ipp.imfiles.dat
+MENU  ipp.load.dat
 
 # HEAD PHP insert_backref ("rawExp.php", "exp_id", $ID['link']);
 
-UNRESTRICTED WHERE 0>1
+UNRESTRICTED WHERE dateobs >= CURDATE()
 
 OP   OP1  $ra * 57.295783
Index: /trunk/ippMonitor/def/rawScienceExp.d
===================================================================
--- /trunk/ippMonitor/def/rawScienceExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/rawScienceExp.d	(revision 40882)
@@ -6,4 +6,7 @@
 # limit this table to OBJECT types of images
 WHERE (rawExp.exp_type = 'OBJECT' or rawExp.exp_type = 'LIGHT')
+
+RESTRICT_COUNT AND dateobs >= CURDATE()
+UNRESTRICTED AND dateobs >= CURDATE()
 
 ARGS ARG1 rawImfile.exp_id=$exp_id
Index: /trunk/ippMonitor/def/simplePlotCamImage.d
===================================================================
--- /trunk/ippMonitor/def/simplePlotCamImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/simplePlotCamImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE camProcessedExp, camRun, chipRun, rawExp
+TABLE camProcessedExp JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE New sky plot - cam
 FILE  simplePlotCamImage.php
@@ -5,7 +5,4 @@
 
 WHERE camRun.state != 'new' 
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE camProcessedExp.cam_id = camRun.cam_id
 
 #    field                size  format  name           show     link to         extras
Index: /trunk/ippMonitor/def/simplePlotChipImage.d
===================================================================
--- /trunk/ippMonitor/def/simplePlotChipImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/simplePlotChipImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE chipRun, rawExp
+TABLE chipRun JOIN rawExp USING (exp_id)
 TITLE New sky plot - chip
 FILE  simplePlotChipImage.php
@@ -5,5 +5,4 @@
 
 WHERE chipRun.state != 'new' 
-WHERE chipRun.exp_id = rawExp.exp_id
 
 #    field                size  format  name           show     link to         extras
Index: /trunk/ippMonitor/def/simplePlotChipQueue.d
===================================================================
--- /trunk/ippMonitor/def/simplePlotChipQueue.d	(revision 40881)
+++ /trunk/ippMonitor/def/simplePlotChipQueue.d	(revision 40882)
@@ -1,8 +1,6 @@
-TABLE chipRun, rawExp
+TABLE chipRun JOIN rawExp USING (exp_id)
 TITLE New sky plot - chip
 FILE  simplePlotChipQueue.php
 MENU  ipp.plots.dat
-
-WHERE chipRun.exp_id = rawExp.exp_id
 
 #    field                size  format  name           show     link to         extras
Index: /trunk/ippMonitor/def/simplePlotDiffImage.d
===================================================================
--- /trunk/ippMonitor/def/simplePlotDiffImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/simplePlotDiffImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE diffRun, diffSkyfile, skycell 
+TABLE diffRun JOIN diffSkyfile USING (diff_id) JOIN skycell USING (skycell_id) 
 TITLE New sky plot - diff
 FILE  simplePlotDiffImage.php
@@ -5,6 +5,4 @@
 
 WHERE diffRun.state != 'new' 
-WHERE diffRun.diff_id = diffSkyfile.diff_id
-WHERE diffSkyfile.skycell_id = skycell.skycell_id
 WHERE diffRun.tess_id = skycell.tess_id
 
Index: /trunk/ippMonitor/def/simplePlotFullForceImage.d
===================================================================
--- /trunk/ippMonitor/def/simplePlotFullForceImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/simplePlotFullForceImage.d	(revision 40882)
@@ -1,4 +1,4 @@
 # TABLE fullForceRun, fullForceResult, skycalRun, stackRun, skycell 
-TABLE fullForceRun, skycalRun, stackRun, skycell 
+TABLE fullForceRun JOIN skycalRun USING (skycal_id) JOIN stackRun USING (stack_id) JOIN skycell USING (skycell_id) 
 TITLE New sky plot - fullForce
 FILE  simplePlotFullForceImage.php
@@ -6,8 +6,5 @@
 
 # WHERE fullForceResult.ff_id  = fullForceRun.ff_id
-WHERE fullForceRun.skycal_id = skycalRun.skycal_id
-WHERE skycalRun.stack_id     = stackRun.stack_id
 WHERE stackRun.tess_id       = skycell.tess_id
-WHERE stackRun.skycell_id    = skycell.skycell_id
 WHERE fullForceRun.state != 'new' 
 
Index: /trunk/ippMonitor/def/simplePlotSkycalImage.d
===================================================================
--- /trunk/ippMonitor/def/simplePlotSkycalImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/simplePlotSkycalImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE skycalRun, skycalResult, stackRun, skycell 
+TABLE skycalRun JOIN skycalResult USING (skycal_id) JOIN stackRun USING (stack_id) JOIN skycell USING (skycell_id) 
 TITLE New sky plot - skycal
 FILE  simplePlotSkycalImage.php
@@ -5,7 +5,4 @@
 
 WHERE skycalRun.state = 'full' 
-WHERE skycalRun.skycal_id = skycalResult.skycal_id
-WHERE skycalRun.stack_id = stackRun.stack_id
-WHERE stackRun.skycell_id = skycell.skycell_id
 WHERE stackRun.tess_id = skycell.tess_id
 
Index: /trunk/ippMonitor/def/simplePlotStackImage.d
===================================================================
--- /trunk/ippMonitor/def/simplePlotStackImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/simplePlotStackImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE stackRun, stackSumSkyfile, skycell 
+TABLE stackRun JOIN stackSumSkyfile USING (stack_id) JOIN skycell USING (skycell_id) 
 TITLE New sky plot - stack
 FILE  simplePlotStackImage.php
@@ -5,6 +5,4 @@
 
 WHERE stackRun.state != 'new' 
-WHERE stackRun.stack_id = stackSumSkyfile.stack_id
-WHERE stackRun.skycell_id = skycell.skycell_id
 WHERE stackRun.tess_id = skycell.tess_id
 
Index: /trunk/ippMonitor/def/simplePlotStaticskyImage.d
===================================================================
--- /trunk/ippMonitor/def/simplePlotStaticskyImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/simplePlotStaticskyImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE staticskyRun, staticskyResult, staticskyInput, stackRun, skycell 
+TABLE staticskyRun JOIN staticskyResult USING (sky_id) JOIN staticskyInput USING (sky_id) JOIN stackRun USING (stack_id) JOIN skycell USING (skycell_id)
 TITLE New sky plot - staticsky
 FILE  simplePlotStaticskyImage.php
@@ -5,8 +5,4 @@
 
 WHERE staticskyRun.state = 'full' 
-WHERE staticskyRun.sky_id = staticskyResult.sky_id
-WHERE staticskyRun.sky_id = staticskyInput.sky_id
-WHERE staticskyInput.stack_id = stackRun.stack_id
-WHERE stackRun.skycell_id = skycell.skycell_id
 WHERE stackRun.tess_id = skycell.tess_id
 
Index: /trunk/ippMonitor/def/skycalFailedSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/skycalFailedSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/skycalFailedSkyfile.d	(revision 40882)
@@ -1,9 +1,7 @@
-TABLE skycalRun, skycalResult, stackRun
+TABLE skycalRun JOIN skycalResult USING (skycal_id) JOIN stackRun USING (stack_id)
 TITLE Skycal Failed Skyfiles
 FILE  skycalfailedSkyfile.php
 MENU  ipp.sky.dat
 
-WHERE skycalRun.stack_id = stackRun.stack_id
-WHERE skycalRun.skycal_id = skycalResult.skycal_id
 WHERE skycalResult.fault != 0
 
Index: /trunk/ippMonitor/def/skycalProcessedSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/skycalProcessedSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/skycalProcessedSkyfile.d	(revision 40882)
@@ -1,9 +1,6 @@
-TABLE skycalRun, skycalResult, stackRun
+TABLE skycalRun JOIN skycalResult USING (skycal_id) JOIN stackRun USING (stack_id)
 TITLE Skycal Processed Skyfiles
 FILE  skycalProcessedSkyfile.php
 MENU  ipp.sky.dat
-
-WHERE skycalRun.stack_id = stackRun.stack_id
-WHERE skycalRun.skycal_id = skycalResult.skycal_id
 
 #        field          size  format  name           show     link to         extras
Index: /trunk/ippMonitor/def/skycalRun.d
===================================================================
--- /trunk/ippMonitor/def/skycalRun.d	(revision 40881)
+++ /trunk/ippMonitor/def/skycalRun.d	(revision 40882)
@@ -1,8 +1,6 @@
-TABLE skycalRun, stackRun
+TABLE skycalRun JOIN stackRun USING (stack_id)
 TITLE skycalRun
 FILE  skycalRun.php
 MENU  ipp.sky.dat
-
-WHERE skycalRun.stack_id = stackRun.stack_id
 
 #        field          size  format  name           show     link to         extras
Index: /trunk/ippMonitor/def/skycal_failure.d
===================================================================
--- /trunk/ippMonitor/def/skycal_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/skycal_failure.d	(revision 40882)
@@ -1,9 +1,7 @@
-TABLE skycalRun, skycalResult, stackRun
+TABLE skycalRun JOIN skycalResult USING (skycal_id) JOIN stackRun USING (stack_id)
 TITLE skycal Failure
 FILE  skycal_failure.php
 MENU  ipp.sky.dat
 
-WHERE skycalRun.stack_id = stackRun.stack_id
-WHERE skycalRun.skycal_id = skycalResult.skycal_id
 WHERE skycalResult.fault != 0
 
Index: /trunk/ippMonitor/def/stackFailedSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/stackFailedSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/stackFailedSkyfile.d	(revision 40882)
@@ -1,8 +1,7 @@
-TABLE stackRun, stackSumSkyfile
+TABLE stackRun JOIN stackSumSkyfile USING (stack_id)
 TITLE Stack Failed Skyfiles
 FILE  stackFailedSkyfile.php
 MENU  ipp.stack.dat
 
-WHERE stackRun.stack_id = stackSumSkyfile.stack_id
 WHERE stackSumSkyfile.fault != 0
 
Index: /trunk/ippMonitor/def/stackInputSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/stackInputSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/stackInputSkyfile.d	(revision 40882)
@@ -1,19 +1,12 @@
-TABLE stackInputSkyfile, stackRun, warpRun, warpSkyfile, fakeRun, camRun, camProcessedExp, chipRun, rawExp
+TABLE stackInputSkyfile JOIN stackRun USING (stack_id) JOIN warpRun USING (warp_id) JOIN warpSkyfile USING (warp_id) JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE Stack Input Exposures
 FILE  stackInputSkyfile.php
 MENU  ipp.stack.dat
 
-WHERE stackRun.stack_id = stackInputSkyfile.stack_id
-WHERE stackInputSkyfile.warp_id = warpRun.warp_id
-WHERE warpRun.fake_id = fakeRun.fake_id
-WHERE warpSkyfile.warp_id = warpRun.warp_id
-WHERE warpSkyfile.skycell_id = stackRun.skycell_id
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camProcessedExp.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 # if no query restrictions are supplied, we want to limit the query or it is extremely long running:
-UNRESTRICTED AND stackRun.stack_id = 0
+#UNRESTRICTED AND stackRun.stack_id = 0
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/stackProcessedSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/stackProcessedSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/stackProcessedSkyfile.d	(revision 40882)
@@ -1,8 +1,7 @@
-TABLE stackRun, stackSumSkyfile
+TABLE stackRun JOIN stackSumSkyfile USING (stack_id)
 TITLE Stack Processed Skyfiles
 FILE  stackProcessedSkyfile.php
 MENU  ipp.stack.dat
 
-WHERE stackRun.stack_id = stackSumSkyfile.stack_id
 WHERE stackRun.state = 'full'
 WHERE stackSumSkyfile.fault = 0
Index: /trunk/ippMonitor/def/stackProcessedSkyfile_Images.d
===================================================================
--- /trunk/ippMonitor/def/stackProcessedSkyfile_Images.d	(revision 40881)
+++ /trunk/ippMonitor/def/stackProcessedSkyfile_Images.d	(revision 40882)
@@ -1,8 +1,7 @@
-TABLE stackRun, stackSumSkyfile
+TABLE stackRun JOIN stackSumSkyfile USING (stack_id)
 TITLE Stack Processed Skyfiles
 FILE  stackProcessedSkyfile_Images.php
 MENU  ipp.stack.dat
 
-WHERE stackRun.stack_id = stackSumSkyfile.stack_id
 WHERE stackRun.state = 'full'
 WHERE stackSumSkyfile.fault = 0
Index: /trunk/ippMonitor/def/stackSummary_Images.d
===================================================================
--- /trunk/ippMonitor/def/stackSummary_Images.d	(revision 40881)
+++ /trunk/ippMonitor/def/stackSummary_Images.d	(revision 40882)
@@ -1,9 +1,6 @@
-TABLE stackAssociation, stackSummary
+TABLE stackAssociation JOIN stackSummary USING (sass_id)
 TITLE Stack Summary w/ Images
 FILE  stackSummary_Images.php
 MENU  ipp.stack.dat
-
-# TODO
-WHERE stackSummary.sass_id = stackAssociation.sass_id
 
 # define image names to be used below
Index: /trunk/ippMonitor/def/staticskyFailedSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/staticskyFailedSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/staticskyFailedSkyfile.d	(revision 40882)
@@ -1,10 +1,7 @@
-TABLE staticskyInput, staticskyRun, stackRun, staticskyResult
+TABLE staticskyInput JOIN staticskyRun USING (sky_id) JOIN stackRun USING (stack_id) JOIN staticskyResult USING (sky_id)
 TITLE Static Sky Failed 
 FILE  staticskyFailedSkyfile.php
 MENU  ipp.sky.dat
 
-WHERE staticskyRun.sky_id = staticskyInput.sky_id
-WHERE staticskyInput.stack_id = stackRun.stack_id
-WHERE staticskyInput.sky_id = staticskyResult.sky_id
 WHERE staticskyResult.fault != 0
 
Index: /trunk/ippMonitor/def/staticskyInputSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/staticskyInputSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/staticskyInputSkyfile.d	(revision 40882)
@@ -1,9 +1,6 @@
-TABLE staticskyInput, staticskyRun, stackRun
+TABLE staticskyInput JOIN staticskyRun USING (sky_id) JOIN stackRun USING (stack_id)
 TITLE Static Sky Input Exposures
 FILE  staticskyInputSkyfile.php
 MENU  ipp.sky.dat
-
-WHERE staticskyRun.sky_id = staticskyInput.sky_id
-WHERE staticskyInput.stack_id = stackRun.stack_id
 
 #        field                          size  format  name           show     link to         extras
Index: /trunk/ippMonitor/def/staticskyProcessedSkyfile.d
===================================================================
--- /trunk/ippMonitor/def/staticskyProcessedSkyfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/staticskyProcessedSkyfile.d	(revision 40882)
@@ -1,10 +1,6 @@
-TABLE staticskyInput, staticskyRun, stackRun, staticskyResult
+TABLE staticskyInput JOIN staticskyRun USING (sky_id) JOIN stackRun USING (stack_id) JOIN staticskyResult USING (sky_id)
 TITLE Static Sky Processed 
 FILE  staticskyProcessedSkyfile.php
 MENU  ipp.sky.dat
-
-WHERE staticskyRun.sky_id = staticskyInput.sky_id
-WHERE staticskyInput.stack_id = stackRun.stack_id
-WHERE staticskyInput.sky_id = staticskyResult.sky_id
 
 #        field                          size  format  name           show     link to         extras
Index: /trunk/ippMonitor/def/staticsky_failure.d
===================================================================
--- /trunk/ippMonitor/def/staticsky_failure.d	(revision 40881)
+++ /trunk/ippMonitor/def/staticsky_failure.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE staticskyRun JOIN staticskyResult USING(sky_id) JOIN staticskyInput USING(sky_id) JOIN stackRun USING(stack_id)
+TABLE staticskyRun JOIN staticskyResult USING (sky_id) JOIN staticskyInput USING (sky_id) JOIN stackRun USING (stack_id)
 TITLE Static Sky Failed (Log)
 FILE  failedStaticsky.php
Index: /trunk/ippMonitor/def/subsetPlotDiffImage.d
===================================================================
--- /trunk/ippMonitor/def/subsetPlotDiffImage.d	(revision 40881)
+++ /trunk/ippMonitor/def/subsetPlotDiffImage.d	(revision 40882)
@@ -1,3 +1,3 @@
-TABLE diffRun, diffInputSkyfile, diffSkyfile, skycell 
+TABLE diffRun JOIN diffInputSkyfile USING (diff_id) JOIN diffSkyfile USING (skycell_id) JOIN skycell USING (skycell_id)
 TITLE New sky plot - diff
 FILE  subsetPlotDiffImage.php
@@ -5,8 +5,4 @@
 
 WHERE diffRun.state != 'new' 
-WHERE diffRun.diff_id             = diffInputSkyfile.diff_id 
-WHERE diffInputSkyfile.diff_id    = diffSkyfile.diff_id
-WHERE diffInputSkyfile.skycell_id = diffSkyfile.skycell_id
-WHERE diffSkyfile.skycell_id      = skycell.skycell_id
 WHERE diffRun.tess_id             = skycell.tess_id
 WHERE MOD(diffInputSkyfile.diff_skyfile_id, 50)   = 0
Index: /trunk/ippMonitor/def/summitImfile.d
===================================================================
--- /trunk/ippMonitor/def/summitImfile.d	(revision 40881)
+++ /trunk/ippMonitor/def/summitImfile.d	(revision 40882)
@@ -3,6 +3,4 @@
 FILE  summitImfile.php
 MENU  ipp.load.dat
-
-UNRESTRICTED WHERE 0>1
 
 #        field     size  format  name             show   link to         extras
Index: /trunk/ippMonitor/def/warpFailedSkyfiles.d
===================================================================
--- /trunk/ippMonitor/def/warpFailedSkyfiles.d	(revision 40881)
+++ /trunk/ippMonitor/def/warpFailedSkyfiles.d	(revision 40882)
@@ -1,13 +1,11 @@
-TABLE warpSkyfile, warpRun, fakeRun, camRun, chipRun, rawExp
+TABLE warpSkyfile JOIN warpRun USING (warp_id) JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE Warp Failed Skyfiles
 FILE  warpFailedSkyfiles.php
 MENU  ipp.science.dat
 
-WHERE warpSkyfile.warp_id = warpRun.warp_id
-WHERE warpRun.fake_id = fakeRun.fake_id
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
 WHERE warpSkyfile.fault != 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/warpProcessedSkyfiles.d
===================================================================
--- /trunk/ippMonitor/def/warpProcessedSkyfiles.d	(revision 40881)
+++ /trunk/ippMonitor/def/warpProcessedSkyfiles.d	(revision 40882)
@@ -1,9 +1,9 @@
-TABLE rawExp JOIN chipRun USING(exp_id) JOIN camRun USING(chip_id) JOIN fakeRun USING(cam_id) JOIN warpRun USING(fake_id) JOIN warpSkyfile USING(warp_id)
+TABLE rawExp JOIN chipRun USING (exp_id) JOIN camRun USING (chip_id) JOIN fakeRun USING (cam_id) JOIN warpRun USING (fake_id) JOIN warpSkyfile USING (warp_id)
 TITLE Warp Processed Skyfiles
 FILE  warpProcessedSkyfiles.php
 MENU  ipp.science.dat
 
-RESTRICT_COUNT WHERE dateobs >= CURDATE()
-UNRESTRICTED WHERE dateobs >= CURDATE()
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/warpProcessedSkyfiles_Images.d
===================================================================
--- /trunk/ippMonitor/def/warpProcessedSkyfiles_Images.d	(revision 40881)
+++ /trunk/ippMonitor/def/warpProcessedSkyfiles_Images.d	(revision 40882)
@@ -1,9 +1,9 @@
-TABLE  rawExp JOIN chipRun USING(exp_id) JOIN camRun USING(chip_id) JOIN fakeRun USING(cam_id) JOIN warpRun USING(fake_id) JOIN warpSkyfile USING(warp_id)
+TABLE  rawExp JOIN chipRun USING (exp_id) JOIN camRun USING (chip_id) JOIN fakeRun USING (cam_id) JOIN warpRun USING (fake_id) JOIN warpSkyfile USING (warp_id)
 TITLE Warp Processed Skyfiles
 FILE  warpProcessedSkyfiles_Images.php
 MENU  ipp.science.dat
 
-RESTRICT_COUNT WHERE dateobs >= CURDATE()
-UNRESTRICTED WHERE dateobs >= CURDATE()
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 # UNRESTRICTED WHERE 0=1
Index: /trunk/ippMonitor/def/warpSkycellMap.d
===================================================================
--- /trunk/ippMonitor/def/warpSkycellMap.d	(revision 40881)
+++ /trunk/ippMonitor/def/warpSkycellMap.d	(revision 40882)
@@ -1,11 +1,9 @@
-TABLE warpSkyCellMap, warpRun, camProcessedExp, chipRun, rawExp
+TABLE warpSkyCellMap JOIN warpRun USING (warp_id) JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE warpSkyCellMap
 FILE  warpSkycellMap.php
 MENU  ipp.science.dat
 
-WHERE warpSkyCellMap.warp_id     = warpRun.warp_id
-WHERE warpSkyCellMap.cam_id      = camProcessedExp.cam_id
-WHERE camProcessedExp.chip_id    = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
 
 OP   OP1  $rawExp.ra * 57.295783
Index: /trunk/ippMonitor/def/warpStageExp.d
===================================================================
--- /trunk/ippMonitor/def/warpStageExp.d	(revision 40881)
+++ /trunk/ippMonitor/def/warpStageExp.d	(revision 40882)
@@ -1,11 +1,9 @@
-TABLE warpRun, fakeRun, camRun, chipRun, rawExp
+TABLE warpRun JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE Warp Stage Exposures
 FILE  warpStageExp.php
 MENU  ipp.science.dat
 
-WHERE warpRun.fake_id = fakeRun.fake_id
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/warpStageSkyfileInputs.d
===================================================================
--- /trunk/ippMonitor/def/warpStageSkyfileInputs.d	(revision 40881)
+++ /trunk/ippMonitor/def/warpStageSkyfileInputs.d	(revision 40882)
@@ -1,17 +1,14 @@
-TABLE warpSkyCellMap, warpRun, fakeRun, camRun, chipRun, rawExp, chipProcessedImfile
+TABLE warpSkyCellMap JOIN warpRun USING (warp_id) JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id) JOIN chipProcessedImfile USING (chip_id)
 TITLE Warp Stage Skyfile Inputs
 FILE  warpStageSkyfileInputs.php
 MENU  ipp.science.dat
 
-WHERE warpSkyCellMap.warp_id = warpRun.warp_id
-WHERE warpRun.fake_id = fakeRun.fake_id
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
-WHERE chipProcessedImfile.chip_id = chipRun.chip_id
 WHERE chipProcessedImfile.class_id = warpSkyCellMap.class_id
 
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
+
 # if no query restrictions are supplied, we want to limit the query or it is extremely long running:
-UNRESTRICTED AND warpRun.warp_id = 0
+#UNRESTRICTED AND warpRun.warp_id = 0
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
Index: /trunk/ippMonitor/def/warpStageSkyfiles.d
===================================================================
--- /trunk/ippMonitor/def/warpStageSkyfiles.d	(revision 40881)
+++ /trunk/ippMonitor/def/warpStageSkyfiles.d	(revision 40882)
@@ -1,12 +1,9 @@
-TABLE warpSkyCellMap, warpRun, fakeRun, camRun, chipRun, rawExp
+TABLE warpSkyCellMap JOIN warpRun USING (warp_id) JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)
 TITLE Warp Stage Skyfiles
 FILE  warpStageSkyfiles.php
 MENU  ipp.science.dat
 
-WHERE warpSkyCellMap.warp_id = warpRun.warp_id
-WHERE warpRun.fake_id = fakeRun.fake_id
-WHERE fakeRun.cam_id = camRun.cam_id
-WHERE camRun.chip_id = chipRun.chip_id
-WHERE chipRun.exp_id = rawExp.exp_id
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
 
 ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
