본문 바로가기
프로그램...

Mysql Query - Insert or Update

by 크크다스 2024. 7. 3.
반응형

 

INSERT INTO stat_traffic_monthly 
VALUES('2024-07-01 00:00:00', 'AP10', 0, 63334484, 4024465, 49168, 46573, 0, 0, 0, 3)
ON DUPLICATE KEY UPDATE
	tx_octet=tx_octet+63334484, rx_octet=rx_octet+4024465, tx_packet=tx_packet+49168, rx_packet=rx_packet+46573, tx_error=tx_error+0, tx_dropped=tx_dropped+0, rx_dropped=rx_dropped+3
;

 

 

https://www.atlassian.com/data/admin/how-to-insert-if-row-does-not-exist-upsert-in-mysql

 

Upsert Techniques in MySQL: INSERT If Not Exists | Atlassian

Learn to insert rows in MySQL only if they don't exist. Explore techniques like INSERT IGNORE, REPLACE, and ON DUPLICATE KEY UPDATE. Dive into the guide!

www.atlassian.com

 

Insert시 Duplicated key 에러 발생하면 Update함

 

 

반응형

'프로그램...' 카테고리의 다른 글

[RSSI] 기준 위치 측정 후 Table화하기  (0) 2019.11.05
[MySql] Character Set  (0) 2019.09.04
[Perl] 잡다(Sort, .....)  (0) 2019.08.23
[색상] 색의 표현 방식 [펌]  (0) 2019.05.03
[스크립트] Lua  (0) 2019.03.14