Possible duplicate:
Parameterizing an SQL IN Clause?
Suppose I had a school table in which school_name, school_enrolment
As input to my program, someone enters a list of schools that they would like to enroll in. Instead of generating an SQL query, for example:
SELECT * FROM school_table WHERE school_name = 'program_input_1' or school_name = 'program_input_2' or school_name = 'program_input_3'
maybe or just do something like
SELECT * from school_table WHERE school name in [array of program inputs]
how is a cleaner way to write this?
source share