Skip to content

Instantly share code, notes, and snippets.

@lfalvarez
Created August 11, 2015 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfalvarez/b903268a02bada18a6eb to your computer and use it in GitHub Desktop.
Save lfalvarez/b903268a02bada18a6eb to your computer and use it in GitHub Desktop.
SQL util para barriosenaccion
COPY(select DISTINCT ON (problem.id) problem.id, body.name, problem.name, users.email, problem.title, problem.state, problem.category, problem.detail, problem.latitude, problem.longitude from problem, users, body where problem.user_id=users.id AND problem.state in ('confirmed', 'investigating', 'in progress', 'planned', 'action scheduled', 'fixed', 'fixed - council', 'fixed - user', 'unable to fix', 'not responsible', 'duplicate', 'closed', 'internal referral') AND problem.whensent > NOW() - INTERVAL '5 weeks' and body.id IN (1, 2, 5)) to stdout
COPY(select users.id, users.name, users.email, from_body from users, body ) to STDOUT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment