Index: trunk/ippMonitor/def/camIQstats.d
===================================================================
--- trunk/ippMonitor/def/camIQstats.d	(revision 36788)
+++ 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
