Skip to main content

Ne

Inequality comparison (left != right). Extends CompOperator. Shorthand keys: !=, ne.

Constructor

Ne(left: string | SqlElement, right?: any): Ne
new Ne(left: string | SqlElement, right?: any): Ne

Dual-callable. left can be a field-name string (optionally with a trailing []) or an SQL element; right can be a literal, Param, Raw, or sub-Select.

import { Ne, Select } from '@sqb/builder';

Select().from('customers').where(Ne('id', 1));
// where id != 1

Properties

Inherits every property from CompOperator (_type, _left, _right, _symbol, _isArray); _symbol is always '!='.

Methods

Inherits ._serialize() from CompOperator; Ne adds no methods of its own.

Object-literal shorthand

Select().from('customers').where({ 'name !=': 'John', 'age ne': 30 });
// where name != 'John' and age != 30

See also