Create CASE WHEN expression for conditional logic in SQL.
import { createBuilder, case_when } from 'coral-sql'const [sql, bindings] = createBuilder() .from('users') .column( case_when() .when('status', '=', 'active').then('Active User') .when('status', '=', 'pending').then('Pending User') .else('Unknown Status'), 'status_label' ) .toSQL() Copy
import { createBuilder, case_when } from 'coral-sql'const [sql, bindings] = createBuilder() .from('users') .column( case_when() .when('status', '=', 'active').then('Active User') .when('status', '=', 'pending').then('Pending User') .else('Unknown Status'), 'status_label' ) .toSQL()
ConditionExpressionCaseWhen instance for chaining
Create CASE WHEN expression for conditional logic in SQL.