Single query generator