# AND keyword in CQL (Confluence): syntax and examples

URL: https://goingstellar.ro/reference/cql/and-keyword/

AND joins two clauses and keeps only the content that matches both. Chain as many as you need to narrow a search. When you mix AND with OR in one query, AND is evaluated first.

## Syntax

```
clause1 AND clause2
clause1 and clause2 and clause3
```

## Arguments

- `clause` (optional: yes): Any CQL clause of the form field operator value.

## Works with

- Operators: joins clauses that use any operator.
- Functions: any function that sits inside a clause, such as currentUser() or now().
- Not with: a leading or trailing AND. It needs a clause on each side.

## Examples

```
type = page and space = SD and title ~ "policy"
```

Finds policy pages in one space only. Run on Confluence Cloud on 2026-11-29.

```
type = attachment and (fileExtension = "svg" or fileExtension = "jpg")
```

Limits an either-or choice to attachments by grouping it in parentheses. Run on Confluence Cloud on 2026-11-29.

```
type = page and title ~ "runbook" and ancestor = 32964613
```

Finds runbooks that sit under the company handbook. Run on Confluence Cloud on 2026-11-29.

```
type = page and space = SD and lastmodified >= now("-2w") and creator = currentUser()
```

Lists your own pages in a space that changed in the last two weeks. Run on Confluence Cloud on 2026-11-29.

```
type = page AND space = SD
```

Same as the lowercase form, written in capitals the way most CQL guides do. Run on Confluence Cloud on 2026-11-29.

## Pitfalls

- AND is evaluated before OR. `type = comment or type = page and title ~ "checkout"` returns every comment plus the matching page, while `(type = comment or type = page) and title ~ "checkout"` returns the page only (checked on Confluence Cloud, November 2026). Add parentheses when you mean the second one.
- Case does not matter. `and`, `AND` and `And` all run (checked on Confluence Cloud, November 2026), so the lowercase keywords in the Atlassian examples are fine.
- Two clauses with nothing between them are not joined. `type = page space = SD` is a syntax error, and the error text is only "Could not parse cql".
- A comma is not AND. To match several values of one field use IN, since one field can hold only one value for most content.

## Related

- [OR](https://goingstellar.ro/reference/cql/or-keyword/)
- [NOT](https://goingstellar.ro/reference/cql/not-keyword/)
- [IN](https://goingstellar.ro/reference/cql/in-operator/)
- [=](https://goingstellar.ro/reference/cql/equals-operator/)
- [ORDER BY](https://goingstellar.ro/reference/cql/order-by/)
- [Reserved characters and words](https://goingstellar.ro/reference/cql/reserved-words/)

## Sources

- [CQL keywords (Atlassian Developer, Confluence Cloud)](https://developer.atlassian.com/cloud/confluence/cql-keywords/)

