ment = " SELECT {$this->get_sql_clause( 'select', 'filtered' )} FROM {$this->get_sql_clause( 'from', 'filtered' )} {$join} WHERE 1=1 {$where} "; if ( ! empty( $group_by ) ) { $statement .= " GROUP BY {$group_by} "; if ( ! empty( $having ) ) { $statement .= " HAVING 1=1 {$having} "; } } if ( ! empty( $order_by ) ) { $statement .= " ORDER BY {$order_by} "; } return $statement . $this->get_sql_clause( 'limit', 'filtered' ); } /** * Reinitialize the clause array. */ public function clear_all_clauses() { $this->sql_clauses = array( 'select' => array(), 'from' => array(), 'left_join' => array(), 'join' => array(), 'right_join' => array(), 'where' => array(), 'where_time' => array(), 'group_by' => array(), 'having' => array(), 'limit' => array(), 'order_by' => array(), ); } }