Skip to content

Instantly share code, notes, and snippets.

@Brahyt
Last active January 9, 2020 17:42
Show Gist options
  • Select an option

  • Save Brahyt/a12c0e78d44cf6cc014e44195ba9ecac to your computer and use it in GitHub Desktop.

Select an option

Save Brahyt/a12c0e78d44cf6cc014e44195ba9ecac to your computer and use it in GitHub Desktop.
SELECT lists_spots.list_id,
lists.name AS list_name,
lists.tags AS list_tags,
users.name AS created_by,
spot_id,
spots.name,
spots.tags AS spots_tags,
spots.address,
spots.city,
spots.state,
spots.lat,
spots.lon AS lng
FROM lists_spots
JOIN spots
ON spot_id = spots.id
JOIN lists
ON list_id = lists.id
JOIN users_lists
ON lists_spots.list_id = users_lists.list_id
JOIN users
ON users_lists.users_id = users.id
WHERE lists_spots.list_id = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment