please views is not a good place for queries, move it to a helper or to the model and call it.