Fixed query so it finds the correct rows of data.