sql_and(X;Y)

Returns a boolean value indicating whether both X and Y are true. This function has SQL-compatible null handling.

Syntax

sql_and(X;Y)

Input

Argument Type Description
X
  • integer
  • big integer
A scalar expression or column expression that evaluates to 0 or 1
Y
  • integer
  • big integer
A scalar expression or column expression that evaluates to 0 or 1

Return Value

sql_and(X;Y) returns a boolean value of 1 if X and Y are both true and 0 if X or Y are false.

The data type of the result is integer.

If X or Y is N/A (null), the result is also N/A.

Example

This example uses the sql_and(X;Y) function to return 1 if colx and coly are both true, which means they contain the value 1. The function returns 0 if colx and/or coly is false.

For null comparison, a column of results using the operator & (logical and) is provided for comparison. For more information, see & (logical and).

<table cols="colx,coly">
  1,0;
  0,1;
  0,0;
  1,1;
  ,1;
  1,;
  0,;
  ,0;
  ,;
</table>
<willbe name="sqland" label="SQL Null" value="sql_and(colx;coly)"/>
<willbe name="and" label="Null" value="colx&coly"/>