I am creating a paramaters table to store values for mulitple sctipts.
For example, I will create a Table called ScriptParameters with the fields ID, scriptname, ScriptValue, and active.
Sample data may be:
ID, scriptname, scriptvalue,active
1, fruit, apple,1
2, fruit, grapes,0
3, fruit, oranges,1
4, veggies, peas,1
5, veggies, corn,1
6, veggies, spinach,1
7, veggies, carrots,1
8, candy, chocolate,1
9, candy, lollipops,0
I want to create a query that will allow me to check and return all values with active fruit dynamically.
If I did this hardcoded, it would look like this:
SELECT * FROM ScriptParameters WHERE scriptvalue='apple' OR scriptvalue='grapes' OR scriptvalue='oranges' AND Active='1'
How can I make the scriptvalue dynamic and maintain the proper syntax?
Any advice would be greatly appreciated!