Skip to content

Instantly share code, notes, and snippets.

@johndavid400
Last active August 29, 2015 13:57
Show Gist options
  • Save johndavid400/9915660 to your computer and use it in GitHub Desktop.
Save johndavid400/9915660 to your computer and use it in GitHub Desktop.
sql query table where ID is contained in an array of IDs
ids = users.pluck(:id)
ids_string = "(" + ids.join(",") + ")"
query = "SELECT id, name FROM table WHERE id_column IN #{ids_string};"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment