How to perform almost the same query N times without rewriting it N times? Basically I have a list of numbers like:

1,2,3,4,5


And I want to perform a query like this for each of the previous numbers:

SELECT COUNT(*), field_name
FROM my_table
WHERE field_name = NUMBER


Where "NUMBER" will be 1, 2 ... 5 in this example. So I expect a result containing 5 rows and 2 columns.

Right now I'm doing the task this way:

(SELECT ... field_name = 1) UNION (SELECT ... field_name = 2 ) ... (SELECT ... field_name = 5)


Is there any alternative way to do this while still using a single query? In particularly I don't like how the last query may become very long as my list of numbers grows.

-----EDIT-----

What if the query to execute would be something like:

SELECT *
FROM my_table
WHERE field_name &gt; NUMBER


Using the same mechanism as above but this time let's image that this query will return more than 1 row at every execution.

Is there any way to create a single, elegant, query to do this job instead of using "UNION" multiple times?
You can use the IN statement 

SELECT COUNT(*), field_name
FROM MY_table
WHERE field_name IN (1,2,3,4,5)
GROUP BY field_name