I need to run a SQL statement that gets a count and has a specific ID value in the where clause. The SQL itself isnt an issue, the issue is I need to rerun this script multiple times using a different ID in the where clause. I could run the script manually and just update the ID every time but I was wondering if there was a way to declare an array or list or something and store the list of IDs in there. Then I'd iterate through the array and replace the ID with the next item in the array each time and then print the count result to the screen for each ID.
For example if I was going to write something in C# to do this I would do something like this:
List<int> newlist = List<int>(){1,2,3,4,5}
foreach(var item in newlist)
{
//excuse syntax this is just an example
sql = "SELECT count(*) FROM testtable WHERE ID = " + item
}
Any help is greatly appreciated!