al max potresti far un ciclo for dove costruisci la query se non vuoi scriverla a mano