[development] Convert query to COUNT query