Skip to content

Instantly share code, notes, and snippets.

@chocobn69
Last active October 3, 2019 13:37
Show Gist options
  • Save chocobn69/5a56fc3f7c90f4b1ad1dad1197e29097 to your computer and use it in GitHub Desktop.
Save chocobn69/5a56fc3f7c90f4b1ad1dad1197e29097 to your computer and use it in GitHub Desktop.
create table town(id, label);
create table road(id, start_town_id, end_town_id);
create table travel(id, road_id);
-- I want all town, both start and end
select
unnest(array[start_town_id, end_town_id])
from travel
inner join road on road_id = road.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment