Added sql for condensing important metrics