Created
November 20, 2015 19:56
-
-
Save yareally/aa4395fd47bb9925135e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class City(id: Long, name: String) | |
case class State(id: Long, abbr: String, name: String) | |
def citiesInPostal(postal: Long): DBIO[Seq[(City, State, Long)]] = { | |
sql"""SELECT c.id, c.name, s.id, s.abbr, s.name, csp.id | |
FROM location_identifier AS li, | |
cities AS c, | |
states AS s, | |
city_state_postal AS csp | |
WHERE csp.postal_code = ${postal} | |
AND csp.postal_code = li.postal_code | |
AND csp.city_id = c.id | |
AND csp.state_id = s.id | |
""".as[(City, State, Long)] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment