# NULLIF()

Use the `nullif()` function as shorthand for a searched case statement where two equal expressions return null.

`nullif()` takes the following syntax. Its two arguments are the expressions that you want to compare.

```nolang
 nullif(fieldName1, fieldName2)
```

In this example, the query returns null for all City values that are Aberdeen. If the City value is not Aberdeen, then it returns the City value.

Here’s how to write the query as a case statement.

```nolang
SELECT CASE WHEN City='Aberdeen'
THEN NULL
ELSE City
END AS City
FROM "Superstore"
GROUP BY City;
```

Here's how to write the same query using `nullif()`.

```nolang
SELECT NULLIF(City, 'Aberdeen') as City
FROM "Superstore"
GROUP BY City;

```

| City        |
| ----------- |
| Aberdeen    |
| Akron       |
| Albuquerque |
| Alexandria  |
