# Variable union`Const`

union: SQLiteCreateSetOperatorFn

Adds `union` set operator to the query.

Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.

See docs: https://orm.drizzle.team/docs/set-operations#union

#### Example

    // Select all unique names from customers and users tables
    import { union } from 'drizzle-orm/sqlite-core'

    await union(
      db.select({ name: users.name }).from(users),
      db.select({ name: customers.name }).from(customers)
    );
    // or
    await db.select({ name: users.name })
      .from(users)
      .union(
        db.select({ name: customers.name }).from(customers)
      );

- Defined in node_modules/.pnpm/drizzle-orm@0.44.6_@cloudflare+workers-types@4.20251014.0_@opentelemetry+api@1.9.0_@typ_31a6f5ca8f102af87864dd251ed08d88/node_modules/drizzle-orm/sqlite-core/query-builders/select.d.ts:491