I find two solutions with SQL and esProc on cross database computing, like belows, hope for a Java solution.

With SQL:
SELECT salesMan
FROM (SELECT salesMan,
row_number() OVER...