I'm attempting to modify a wordpress / MySQL function to show a bit more information. I am presently running the next query that chooses the publish, joins the 'postmeta' and will get the data in which the meta_key = _loved

    function most_liked_posts($numberOf, $before, $after, $show_count) {
 global $wpdb;

    $request = "SELECT ID, post_title, meta_value FROM $wpdb->posts, $wpdb->postmeta";
    $request .= " WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id";
    $request .= " AND post_status='publish' AND post_type='post' AND meta_key='_liked' ";
    $request .= " ORDER BY $wpdb->postmeta.meta_value+0 DESC LIMIT $numberOf";
    $posts = $wpdb->get_results($request);

    foreach ($posts as $post) {
     $post_title = stripslashes($post->post_title);
     $permalink = get_permalink($post->ID);
     $post_count = $post->meta_value;

     echo $before.'<a href="' . $permalink . '" title="' . $post_title.'" rel="nofollow">' . $post_title . '</a>';
  echo $show_count == '1' ? ' ('.$post_count.')' : '';
  echo $after;
    }
}

The key part being: $post_count = $post->meta_value;

However I wish to also grab something that's mounted on each publish known as wbphoto

How do you specify that $publish_count = _loved and $photo = wbphoto

?

This is a screen cap of my Phpmyadmin alt text

The SQL will appear very ugly.

// Your Meta key names
    $metas = array(
        '_liked', '_another1'
    );

    foreach ($metas as $i=>$meta_key) {
        $meta_fields[] = 'm' . $i . '.meta_value as ' . $meta_key;
        $meta_joins[] = ' left join ' . $wpdb->postmeta . ' as m' . $i . ' on m' . $i . '.post_id=' . $wpdb->posts . '.ID and m' . $i . '.meta_key="' . $meta_key . '"';
    }
    $request = "SELECT ID, post_title, " .  join(',', $meta_fields) . " FROM $wpdb->posts ";
    $request .=  join(' ', $meta_joins);
    $request .= " AND post_status='publish' AND post_type='post'";
    $request .= " LIMIT $numberOf";

It will likely be better of creating another SQL to retrieve meta themselves.

Have no idea in the event that can help you, but here is a working SQl query that will get posts and publish_meta.

SELECT DISTINCT ID, p.post_title, p.post_status, p.post_date, m.meta_key, m.meta_value 
FROM wp_posts p, wp_postmeta m
WHERE p.post_author = 2 
AND p.post_status = 'publish' 
AND p.post_date >= '2009-01-01' 
AND p.post_date <= '2010-05-28'
AND p.ID = m.post_id