mysql - Can't CONCAT within query containing GROUP BY -
i have following query (irrelevant parts omitted):
select date_format(calc_dt, '%y-%m-%dt%tz') formatted_calc_dt, concat(date_format(calc_dt, '%y-%m-%dt%tz'), '') calc_calculation_results group formatted_calc_dt
error code: 1055. expression #2 of select list not in group clause , contains nonaggregated column 'my_database_name.calc_calculation_results.calc_dt' not functionally dependent on columns in group clause; incompatible sql_mode=only_full_group_by
the challenge is:
- i need concat formatted
calc_dt
other stuff - i need create view out of query, can't use subqueries
the point of grouping, if helps, group dates hour.
is there way can want?
i think missing key word 'as' in query in 2 places.
try this,
select date_format(calc_dt, '%y-%m-%dt%tz') formatted_calc_dt, concat(date_format(calc_dt, '%y-%m-%dt%tz'), '') other_concat calc_calculation_results group formatted_calc_dt
old part 1:
select date_format(calc_dt, '%y-%m-%dt%tz') formatted_calc_dt,
new part 1:
select date_format(calc_dt, '%y-%m-%dt%tz') formatted_calc_dt,
old part 2:
concat(date_format(calc_dt, '%y-%m-%dt%tz'), '') calc_calculation_results group formatted_calc_dt
new part 2:
concat(date_format(calc_dt, '%y-%m-%dt%tz'), '') other_concat calc_calculation_results group formatted_calc_dt
Comments
Post a Comment