For loop for query
For loop for query