IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15826


Ignore:
Timestamp:
Dec 14, 2007, 10:22:45 AM (18 years ago)
Author:
eugene
Message:

fixed sql to return the correct count of class_ids

File:
1 edited

Legend:

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

    r15769 r15826  
    1 SELECT DISTINCT
    2     *
    3 FROM
    4     (SELECT DISTINCT
    5         detRun.det_id as det_id,
     1SELECT
     2  *
     3--  COUNT(norm_class_id) as nNorm,
     4--  COUNT(stack_class_id) as nStack
     5FROM (
     6    SELECT DISTINCT
     7        detRun.det_id,
    68        detRun.iteration,
    79        detRun.det_type,
    8         detRun.workdir,
     10--      detRun.workdir,
     11--      rawExp.exp_id,
    912        rawExp.camera,
    1013        rawExp.telescope,
    1114        rawExp.exp_type,
    12         detNormalizedImfile.class_id,
    13         rawImfile.class_id as rawimfile_class_id
     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
    1419    FROM detRun
    1520    JOIN detInputExp
     
    1823    JOIN rawExp
    1924        ON detInputExp.exp_id = rawExp.exp_id
    20     JOIN detNormalizedImfile
    21         ON detInputExp.det_id = detNormalizedImfile.det_id
    22         AND detInputExp.iteration = detNormalizedImfile.iteration
    23     LEFT JOIN rawImfile
    24         ON detInputExp.exp_id = rawImfile.exp_id
    25         AND detNormalizedImfile.class_id = rawImfile.class_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
    2632    LEFT JOIN detNormalizedExp
    2733        ON detInputExp.det_id = detNormalizedExp.det_id
    2834        AND detInputExp.iteration = detNormalizedExp.iteration
    2935    WHERE
    30         detRun.state = 'run'
    31         AND detRun.mode = 'master'
    32         AND detNormalizedExp.det_id IS NULL
    33         AND detNormalizedExp.iteration IS NULL
    34         AND detInputExp.include = 1
    35     GROUP BY
    36         detNormalizedImfile.iteration,
    37         detRun.det_id
    38     HAVING
    39         COUNT(detNormalizedImfile.class_id) = COUNT(rawImfile.class_id)
    40         AND SUM(detNormalizedImfile.fault) = 0
    41     ) as Foo
     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
     42GROUP BY
     43  det_id,
     44  iteration
     45HAVING
     46  COUNT(norm_class_id) = COUNT(stack_class_id)
     47  AND SUM(fault) = 0
Note: See TracChangeset for help on using the changeset viewer.