The most common use for this type of query is when you already have a specific list of Person IDs (or other lists of values) in a spreadsheet or document, and you'd like to contact them through Pulse. Rather than replicating the conditions of that report through SQL, you can simply copy and paste this list into the first column of the spreadsheet attached at the bottom of this article.


Then we can copy and paste the last column into our query.



IMPORTANT NOTE: Be sure to remove the comma at the very end of the list that you copied into the query, right after the last item in the list. The query will fail if this comma is not removed.


Template Query


SELECT

*


FROM

***Insert desired table here***


WHERE

***Insert desired field containing list of values here*** IN

(

**Paste list of items between these two brackets, remembering to remove the comma at the very end of the list***

 )


Example Queries


List of Student IDs


SELECT

*


FROM

students


WHERE

person_id IN

(

'1234',

'5678',

'9101112',

'13141516',

'18192021'

 )



List of Course Codes


SELECT

*


FROM

courses


WHERE

course_code IN

(

'BBUS',

'BNUR',

'BENG',

'BPSY',

'MBUS '

 )



List of Residency Statuses


SELECT

*


FROM

students


WHERE

residency IN

(

'AUS',

'AUS-TEMP',

'NZ'

 )