How about a PHP script which accesses directly the MySQL table to do database query? This way, it's easier to maintain than writing it as WP plugin. May I know the wordpress version of your target & destination? If you inform me the WP version, I'll try to write the script for you.