IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15831


Ignore:
Timestamp:
Dec 14, 2007, 2:35:41 PM (18 years ago)
Author:
jhoblitt
Message:

nest SQL statment so where conditions can be tacked on

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/share/dettool_tonormalizedexp.sql

    r15827 r15831  
    1 SELECT
    2   *
    3 --  COUNT(norm_class_id) as nNorm,
    4 --  COUNT(stack_class_id) as nStack
    5 FROM (
    6     SELECT DISTINCT
    7         detRun.det_id,
    8         detRun.iteration,
    9         detRun.det_type,
    10 --      detRun.workdir,
    11 --      rawExp.exp_id,
    12         rawExp.camera,
    13         rawExp.telescope,
    14         rawExp.exp_type,
    15 --      detNormalizedExp.det_id as norm_det_id,
    16         detNormalizedImfile.class_id as norm_class_id,
    17         detNormalizedImfile.fault,
    18         detStackedImfile.class_id as stack_class_id
    19     FROM detRun
    20     JOIN detInputExp
    21         ON detRun.det_id = detInputExp.det_id
    22         AND detRun.iteration = detInputExp.iteration
    23     JOIN rawExp
    24         ON detInputExp.exp_id = rawExp.exp_id
    25     JOIN detStackedImfile
    26         ON detStackedImfile.det_id = detRun.det_id
    27         AND detStackedImfile.iteration = detRun.iteration
    28     LEFT JOIN detNormalizedImfile
    29         ON detStackedImfile.det_id = detNormalizedImfile.det_id
    30         AND detStackedImfile.iteration = detNormalizedImfile.iteration
    31         AND detStackedImfile.class_id = detNormalizedImfile.class_id
    32     LEFT JOIN detNormalizedExp
    33         ON detInputExp.det_id = detNormalizedExp.det_id
    34         AND detInputExp.iteration = detNormalizedExp.iteration
    35     WHERE
    36         detRun.state = 'run' AND
    37         detRun.mode = 'master' AND
    38         detNormalizedExp.det_id IS NULL AND
    39         detNormalizedExp.iteration IS NULL AND
    40         detInputExp.include = 1
    41 ) as Foo
    42 GROUP BY
    43   det_id,
    44   iteration
    45 HAVING
    46   COUNT(norm_class_id) = COUNT(stack_class_id)
    47   AND SUM(fault) = 0
     1SELECT
     2    *
     3FROM (SELECT
     4      *
     5    --  COUNT(norm_class_id) as nNorm,
     6    --  COUNT(stack_class_id) as nStack
     7    FROM (
     8        SELECT DISTINCT
     9            detRun.det_id,
     10            detRun.iteration,
     11            detRun.det_type,
     12    --      detRun.workdir,
     13    --      rawExp.exp_id,
     14            rawExp.camera,
     15            rawExp.telescope,
     16            rawExp.exp_type,
     17    --      detNormalizedExp.det_id as norm_det_id,
     18            detNormalizedImfile.class_id as norm_class_id,
     19            detNormalizedImfile.fault,
     20            detStackedImfile.class_id as stack_class_id
     21        FROM detRun
     22        JOIN detInputExp
     23            ON detRun.det_id = detInputExp.det_id
     24            AND detRun.iteration = detInputExp.iteration
     25        JOIN rawExp
     26            ON detInputExp.exp_id = rawExp.exp_id
     27        JOIN detStackedImfile
     28            ON detStackedImfile.det_id = detRun.det_id
     29            AND detStackedImfile.iteration = detRun.iteration
     30        LEFT JOIN detNormalizedImfile
     31            ON detStackedImfile.det_id = detNormalizedImfile.det_id
     32            AND detStackedImfile.iteration = detNormalizedImfile.iteration
     33            AND detStackedImfile.class_id = detNormalizedImfile.class_id
     34        LEFT JOIN detNormalizedExp
     35            ON detInputExp.det_id = detNormalizedExp.det_id
     36            AND detInputExp.iteration = detNormalizedExp.iteration
     37        WHERE
     38            detRun.state = 'run' AND
     39            detRun.mode = 'master' AND
     40            detNormalizedExp.det_id IS NULL AND
     41            detNormalizedExp.iteration IS NULL AND
     42            detInputExp.include = 1
     43    ) as Foo
     44    GROUP BY
     45      det_id,
     46      iteration
     47    HAVING
     48      COUNT(norm_class_id) = COUNT(stack_class_id)
     49      AND SUM(fault) = 0
     50) as Bar
Note: See TracChangeset for help on using the changeset viewer.