Changeset 18577
- Timestamp:
- Jul 16, 2008, 9:25:45 AM (18 years ago)
- Location:
- trunk/ippTools/share
- Files:
-
- 3 edited
-
stacktool_definebyquery_insert.sql (modified) (1 diff)
-
stacktool_definebyquery_insert_random.sql (modified) (1 diff)
-
stacktool_definebyquery_select.sql (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/stacktool_definebyquery_insert.sql
r18574 r18577 1 -- Define the inputs to a defined stack 1 2 INSERT INTO 2 3 stackInputSkyfile(stack_id, warp_id) 3 4 SELECT 4 @STACK_ID@, 5 @STACK_ID@, -- This should be replaced with the stack_id 5 6 warp_id 6 7 FROM warpSkyfile -
trunk/ippTools/share/stacktool_definebyquery_insert_random.sql
r18574 r18577 1 -- Use a random set of warps for the inputs to a defined stack 1 2 INSERT INTO 2 3 stackInputSkyfile(stack_id, warp_id) 3 4 SELECT 4 @STACK_ID@, 5 @STACK_ID@, -- This should be replaced with the stack_id 5 6 warp_id 6 7 FROM ( 7 SELECT 8 warpSkyfile.*, 9 rand() AS rnd_num 10 FROM warpSkyfile 11 JOIN warpRun 12 USING(warp_id, tess_id) 13 JOIN fakeRun 14 USING(fake_id, tess_id) 15 JOIN camRun 16 USING(cam_id, tess_id) 17 JOIN chipRun 18 USING(chip_id, tess_id) 19 JOIN rawExp 20 USING(exp_id, tess_id) 21 WHERE 22 skycell_id = '%s' 23 AND tess_id = '%s' 24 AND rawExp.filter = '%s' 25 AND warpSkyfile.fault = 0 26 ORDER BY rnd_num 27 LIMIT %d 8 -- Sub-select to get the random set of warps 9 SELECT 10 warpSkyfile.*, 11 rand() AS rnd_num 12 FROM warpSkyfile 13 JOIN warpRun 14 USING(warp_id, tess_id) 15 JOIN fakeRun 16 USING(fake_id, tess_id) 17 JOIN camRun 18 USING(cam_id, tess_id) 19 JOIN chipRun 20 USING(chip_id, tess_id) 21 JOIN rawExp 22 USING(exp_id, tess_id) 23 WHERE 24 skycell_id = '%s' 25 AND tess_id = '%s' 26 AND rawExp.filter = '%s' 27 AND warpSkyfile.fault = 0 28 -- Sort by the random number, and take the first N 29 -- to get a random set of N. 30 ORDER BY rnd_num 31 LIMIT %d 28 32 ) AS randomWarps -
trunk/ippTools/share/stacktool_definebyquery_select.sql
r18574 r18577 1 -- This is the SELECT part of the query to get a list of skycells with 2 -- warps that are ready to be stacked, along with the numbers of warps 3 -- ready to be stacked and already in stacks. It needs to be 4 -- completed by a GROUP BY statement (see below). 5 1 6 SELECT 2 7 warpSkyfile.skycell_id, … … 4 9 stackRun.stack_id, 5 10 rawExp.filter, 6 COUNT(warpSkyfile.skycell_id) AS num_avail, 7 COUNT(stackRun.stack_id) AS num_extant 11 COUNT(warpSkyfile.skycell_id) AS num_avail, -- number available to be stacked 12 COUNT(stackRun.stack_id) AS num_extant -- number already in the stack 8 13 FROM warpRun 9 14 JOIN warpSkyfile … … 28 33 AND warpSkyfile.fault = 0 29 34 -- Here should follow the SQL in stacktool_definebyquery_groupby.sql, 30 -- after a dditional WHERE conditions have been added35 -- after any additional WHERE conditions have been added
Note:
See TracChangeset
for help on using the changeset viewer.
