added order and limit to SQL