0

I have this query :

$sql_errori_doppie="select doc_doppio,count(*) as doppie,data
from(select data,doc_doppio,count(*) as num_lezioni_doppie
from(SELECT cou_id, DATE_FORMAT(FROM_UNIXTIME(cou_ts_1), '%d-%m-%Y %h:%i') as data ,cou_ins_1 as doc_doppio
FROM courses where cou_type='mot' and cou_ins_1<>0
and (substr(DATE_FORMAT(FROM_UNIXTIME(cou_ts_1), '%Y-%d-%m'),1,4))=".$q. " 
UNION ALL 
SELECT cou_id, DATE_FORMAT(FROM_UNIXTIME(cou_ts_2), '%d-%m-%Y %h:%i'),cou_ins_2 FROM courses where cou_type='mot' 
and cou_ins_2<>0 and (substr(DATE_FORMAT(FROM_UNIXTIME(cou_ts_1), '%Y-%d-%m'),1,4))=".$q. " 
UNION ALL 
SELECT cou_id, DATE_FORMAT(FROM_UNIXTIME(cou_ts_3), '%d-%m-%Y %h:%i'),cou_ins_3 FROM courses where cou_type='mot' 
and cou_ins_3<>0 and (substr(DATE_FORMAT(FROM_UNIXTIME(cou_ts_1), '%Y-%d-%m'),1,4))=".$q. " 
)
as da group by data,doc_doppio
having num_lezioni_doppie>1
)
as conteggio group by doc_doppio;";

When I try to do it I Have this message:

SELECT list is not in GROUP BY clause and contains nonaggregated column 'conteggio.data' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

How to change the query or the only_full_group_by parameter?

CinCout
  • 9,486
  • 12
  • 49
  • 67
m.Sarto
  • 179
  • 3
  • 16

0 Answers0