diff options
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sql/item.cc b/sql/item.cc index e9ef3b6a763..d6ed65589f7 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1271,11 +1271,10 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) prev_subselect_item->parsing_place; /* check table fields only if subquery used somewhere out of HAVING - or SELECT list or outer SELECT do not use groupping (i.e. tables - are accessable) + or outer SELECT do not use groupping (i.e. tables are + accessable) */ - if (((place != IN_HAVING && - place != SELECT_LIST) || + if ((place != IN_HAVING || (sl->with_sum_func == 0 && sl->group_list.elements == 0)) && (tmp= find_field_in_tables(thd, this, table_list, &where, @@ -1952,8 +1951,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) or SELECT list or outer SELECT do not use groupping (i.e. tables are accessable) */ - if (((place != IN_HAVING && - place != SELECT_LIST) || + if ((place != IN_HAVING || (sl->with_sum_func == 0 && sl->group_list.elements == 0)) && (tmp= find_field_in_tables(thd, this, table_list, &where, |