Database = factdata
SELECT fSourceKEY AS k, fSourceName AS name, fRightAscension AS ra FROM Source WHERE fSourceTypeKey=1 ORDER BY k
SELECT (fPeriod) AS x, (SUM(fNumExcEvts)*3600/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)) AS y, (SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)/60) AS ontime, (EXCERR(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)*3600) AS e, (LIMA(SUM(fNumSigEvts), SUM(fNumBgEvts))) AS s, (MIN(fRunStart)) as start, (MAX(fRunStop)) as stop, (MIN(fZenithDistanceMin)) as zdmin, (MAX(fZenithDistanceMax)) as zdmax, (MIN(fAzimuthMin)) as azmin, (MAX(fAzimuthMax)) as azmax, (MIN(fThresholdMinSet)) as thmin, (MAX(fThresholdMInSet)) as thmax FROM RunInfo LEFT JOIN AnalysisResultsRunLP USING(fNight,fRunID) WHERE fRunTypeKey=1 AND NOT ISNULL(fNumExcEvts) AND NOT ISNULL(fEffectiveOn) GROUP BY x HAVING (ontime>60) Roundtrip query time: 2413.11 ms