While I'm a little fuzzy on the exact details of what you want, the basic premise is actually quite simple.
You will want to build a custom module, which simply defines some tokens, similar to the following:
/**
* Implements hook_theme().
*/
function my_module_theme() {
return array(
'my_module' => array(
'arguments' => array('object' => NULL)
),
);
}
/**
* Implements hook_token_list().
*/
function my_module_token_list($type = 'all') {
if ($type == 'node' || $type == 'all') {
$tokens = array();
$tokens['my_module']['table-TABLE-ID'] = t('description').
return $tokens;
}
}
/**
* Implements hook_token_values().
*/
function my_module_token_values($type, $object = NULL) {
if ($type == 'node') {
($table, $id) = explode('-', $object->my_field['value']);
$tokens['table-' . $object->my_field['value']] = theme('my_module', db_fetch_object(db_query("SELECT * FROM {" . $table . "} WHERE id = %d", $id)));
return $tokens;
}
}
function theme_my_module($object) {
return '<div>' . $object->content . '</div>';
}
Note: All this code is theoretical and I can pretty much state that it will not work. It is also highly insecure to do the db_query the way I have done it here (which was my interpretation of what you wanted), instead you should have a token for each different type of query you want ('table-node-ID', etc).
Hope this is somewhat helpful.