반응형

에러내용
 which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

수정사항

1) cd /etc/mysql/mysql.conf.d

2) vi mysqld.cnf

- 다음 내용 추가
[mysqld]  
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

3) 서버 재시작
service mysql restart

728x90
반응형


<확인>

*간단한 확인 
select now();

*Time Zone 설정이 되어 있지 않다면 0
select count(*) from mysql.time_zone;

*Time Zone 국가 (KST, EEST ..) 
select @@system_time_zone;

*Time Zone 정보 
 SELECT @@global.time_zone, @@session.time_zone;
> SYSTEM SYSTEM



<변경> 
vi /etc/my.cnf

set time_zone='-07:00'; 

추가후 

systemctl restart mysqld

확인
select now();

[출처]https://www.inmotionhosting.com/support/website/databases/how-to-change-mysql-server-time-zone

728x90
반응형
select
product_name,
ifnull(sum(if(date_format(order_date, '%Y') = '2015', cnt, 0)),0) as "2015",
ifnull(sum(if(date_format(order_date, '%Y') = '2016', cnt, 0)),0) as "2016"
from product a join product_order b
on a.product_id = b.product_id
group by product_name

==

select
product_name,
ifnull(sum(if(date_format(order_date, '%Y') = '2015', cnt, 0)),0) as "2015",
ifnull(sum(if(date_format(order_date, '%Y') = '2016', cnt, 0)),0) as "2016"
from product a, product_order b
where a.product_id = b.product_id
group by product_name

 

728x90

+ Recent posts