Project

General

Profile

dbquery-part2.sql

Aaron Roodman, 05/01/2013 03:51 PM

 
1
-- nohup psql  -A -F","  --pset footer=off -f dbquery-part2.sql > db-part2.csv &  
2

    
3
SELECT e.id AS expid, e.date AS date2,
4
td.tel_el AS tel_el, td.tel_az AS tel_az, td.dome_az AS dome_az, tel_ha AS telha, ha, td.mjd AS mjd
5
FROM exposure.exposure AS e 
6
LEFT OUTER JOIN telescope_data AS td ON td.time_recorded BETWEEN e.date - ((2.0)::VARCHAR || 'seconds')::INTERVAL AND e.date
7
WHERE (e.date BETWEEN '2012-09-14 00:00:00' AND '2013-12-31 10:00:00') 
8
AND e.exptime > 0 AND e.flavor = 'object'
9
ORDER BY e.id