chekos / RIPA-2018-datasette

Publishing datasette of CA's RIPA 2018 data
http://ripa-2018.datasettes.cimarron.io/
GNU General Public License v3.0
0 stars 0 forks source link

Query suggestion #30

Closed chekos closed 4 years ago

chekos commented 4 years ago

Civil Twilight draft

query

SELECT
  *
FROM (SELECT
  main.UNIQUE_ID,
  main.DATE_OF_STOP,
  main.CLOSEST_CITY,
  TIME_OF_STOP,
  twilight.CTWILIGHT_BEGIN as twilight_begin,
  twilight.CTWILIGHT_END as twilight_end,
  CASE WHEN TIME_OF_STOP > twilight.CTWILIGHT_BEGIN AND TIME_OF_STOP < twilight.CTWILIGHT_END THEN "Within civil twilight" ELSE "in the dark..." END as IN_TWILIGHT
FROM
  aa_main_table as main
INNER JOIN
  civil_twilight_hours as twilight
  ON twilight.DATE_OF_STOP = main.DATE_OF_STOP
  AND twilight.CLOSEST_CITY = main.CLOSEST_CITY
)
chekos commented 4 years ago

solved with #33, #34, and #32