get last post’s link with SQL query

Assuming each site is WP, they’ll both have RSS feeds. You’re better off just to fetch the RSS feed and get the latest post link from that.

WP even has some built in support RSS parsing!

<?php
/**
 * An example of how to use fetch feed
 *
 * @uses    fetch_feed
 * @return  bool|string False on failure, the permalink on success
 */
function wpse60754_fetch_feed($feed_url)
{
    $feed = fetch_feed($feed_url);

    if(is_wp_error($feed))
        return false;

    $items = $feed->get_items(0, 1);

    if(count($items))
        return $items[0]->get_permalink();
    else
        return false;
}