Przejdź do głównej treści

WHERE

w części Anatomy of a DPQL query
Lista autorów
Opublikowano: 23 mar 2018|Ostatnio Aktualizowano: 3 lis 2022

The conditions in the optional WHERE clause are used to limit what data is displayed or used in a calculation.

For example, if your query was

FROM tickets
SELECT tickets.id

you’d get a table with every ticket’s ID - not very useful.

But with:

FROM tickets
SELECT tickets.id
WHERE tickets.status = 'awaiting_agent'

you’d get a table with the IDs of just the tickets with a status of Awaiting Agent.

Conditions can be joined by operators such as AND, OR, NOT, IN and parentheses (brackets) to make complex expressions.

IN is useful if you want to match any one of a number of different values. For example:

WHERE tickets.status IN ('awaiting_agent','awaiting_user')

will return all tickets with either Awaiting Agent or Awaiting User status.

tickets.labels.label != NULL

will return all tickets that have a label (i.e. the label value does not equal NULL).

PrzydatneNieprzydatne
następna stronaSPLIT BY
poprzednia stronaFROM

Zaloguj lub zarejestruj się, by złożyć komentarz.