Help setting up a sql query
Ok, if i understand you clearly, then this is the solution // first get the post ids that have the breakfast food type $post_ids = $wpdb->get_col( “SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = ‘type’ AND meta_value=”Breakfast”” ); // now get the food names $stocktypes = $wpdb->get_col( “SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = … Read more