Skip to content

Proper syntax for "WHERE column IN [ArrayOfValues]"? #82

Closed
@jfeldstein

Description

@jfeldstein

I have an array of user ids, and would like to select all the users at once.

This query:

  this.db.query({
    text: "SELECT * FROM users WHERE remote_id IN $1 AND provider = $2",
    values: [array_of_ids, provider_string]
  }, cb);

Gives the error error: syntax error at or near "$1"

What's the correct syntax for this? Couldn't find it in the documentation or via google.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions