$wpdb select all meta for each post

This is really simple.

get_post_meta($postid);

This will return all values in about the same syntax.

In a more workable loop:

<?php
    $custom = new WP_Query(array("posts_per_page" => -1))
    if( $custom->have_posts() ) {
        while ( $custom->have_posts() ) {
            the_post();
            $data = get_post_meta(get_the_ID());
        }
    } else {
        /* No posts found */
    }
?>