メインコンテンツへスキップ

Using IN with DPQL - ナレッジベース / DPQL - DeskPRO

Using IN with DPQL

作成者一覧


As well as the expressions referenced in our guides  you can use the IN function in DPQL.

The IN operator allows you to specify multiple values in the WHERE clause - essentially it's a shorthand for multiple 'OR' arguments.


A common example of where this might be used is when querying statuses.


You might want to count all the open ticket in your helpdesk.

In Deskpro though open tickets can fall under one of three statuses  - awaiting agent, awaiting user and pending.


Using OR


You could run the below:


SELECT DPQL_COUNT

FROM tickets

WHERE tickets.status = 'awaiting_agent' OR tickets.status = 'awaiting_user' OR tickets.status = 'pending'


Using IN


An easier way to do it though is to use the IN operator:


SELECT DPQL_COUNT

FROM tickets

WHERE tickets.status IN('awating agent', 'awaiting_user', 'pending'




参考になった 役に立たない

1 人中 0 人がこのページは参考になったと答えました

コメントを追加

コメントを投稿するには、ログインまたは登録が必要です。

パスワードをお忘れですか?