sets up sql call for top 10, if tie take lower id