You mean the same block of code but distinct SQL query, right? I can make it a function that takes the SQL query as a parameter