Skip to content

List to an SQL IN() clause

Turn a column of values into a parenthesised list for WHERE ... IN (...).

  1. 1.Text to array converter

Paste the values — order numbers, SKUs, user IDs, one per line — and get the parenthesised list that goes after IN in a WHERE clause. Values are single-quoted, because a double-quoted value is an identifier in PostgreSQL and standard SQL rather than a string, and an apostrophe inside a value is escaped by doubling it, the one escaping rule that works across database engines.

Numbers are written without quotes, so a list of integer IDs comes out as a numeric list ready for an integer column. This is a query fragment, not a full statement: paste it after your own WHERE column IN. The values never leave your browser, which is the point when they are customer or order identifiers.

Questions

Why single quotes and not double?
In standard SQL a double-quoted token is an identifier — a column or table name — not a string. Single quotes are the portable way to write a string literal, so this format always uses them.
How are apostrophes inside a value handled?
They are doubled, so O'Brien becomes 'O''Brien'. That is the escaping rule every major dialect accepts.
Does it write the whole query?
No, only the list in parentheses. You add your own SELECT and WHERE column IN in front of it, so it fits whatever query you are writing.

Build your own chain in the pipeline builder.