How do I select two meta_value by $ wpdb-> get_row mode?

Question

How do I select two meta_value via $ wpdb-> get_row or a lighter way?

global $wpdb;
$id = get_the_ID();
$selecttwovalue = $wpdb->get_row("SELECT  PM.meta_value, DU.meta_value
FROM $wpdb->posts AS P
LEFT JOIN $wpdb->postmeta AS PM on PM.meta_key = 'american_brother_1'
   JOIN $wpdb->postmeta AS DU on DU.meta_key = 'american_brother_2'
WHERE p.ID = '$id'");
        
        
       echo $selecttwovalue->PM;
0
Avant World 4 months 0 Answers 18 views 0

Leave an answer