sort result from db