Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 17644)
+++ wp-includes/query.php	(working copy)
@@ -2478,6 +2478,7 @@
 			$clauses = call_user_func_array( '_get_meta_sql', array( $q['meta_query'], 'post', $wpdb->posts, 'ID', &$this) );
 			$join .= $clauses['join'];
 			$where .= $clauses['where'];
+			$distinct = 'DISTINCT';
 		}
 
 		// Apply filters on where and join prior to paging so that any
Index: wp-includes/meta.php
===================================================================
--- wp-includes/meta.php	(revision 17644)
+++ wp-includes/meta.php	(working copy)
@@ -382,10 +382,18 @@
 
 	$meta_id_column = esc_sql( $type . '_id' );
 
+	$relation = 'AND';
+	if( isset( $meta_query['relation'] ) && strtoupper( $meta_query['relation'] ) == 'OR' ) {
+		$relation = 'OR';
+	} else {
+		$meta_query['relation'] = '';
+	}
+	unset( $meta_query['relation'] );
+
 	$join = '';
-	$where = '';
+	$where = array();
 	$i = 0;
-	foreach ( $meta_query as $q ) {
+	foreach ( $meta_query as $k => $q ) {
 		$meta_key = isset( $q['key'] ) ? trim( $q['key'] ) : '';
 		$meta_value = isset( $q['value'] ) ? $q['value'] : '';
 		$meta_compare = isset( $q['compare'] ) ? strtoupper( $q['compare'] ) : '=';
@@ -411,7 +419,7 @@
 		$i++;
 
 		if ( !empty( $meta_key ) )
-			$where .= $wpdb->prepare( " AND $alias.meta_key = %s", $meta_key );
+			$where[$k] = $wpdb->prepare( "($alias.meta_key = %s", $meta_key );
 
 		if ( in_array( $meta_compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {
 			if ( ! is_array( $meta_value ) )
@@ -439,8 +447,10 @@
 		if ( '_wp_zero_value' == $meta_value )
 			$meta_value = 0;
 
-		$where .= $wpdb->prepare( " AND CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string}", $meta_value );
+		$where[$k] .= $wpdb->prepare( " AND CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string})", $meta_value );
 	}
+	
+	$where = ' AND ( '. implode( " $relation ", $where ) .' )';
 
 	return apply_filters_ref_array( 'get_meta_sql', array( compact( 'join', 'where' ), $meta_query, $type, $primary_table, $primary_id_column, &$context ) );
 }
