Monday, 17th Jun

aba6a3N85SVLJ35347
4241e2VP-CYWA3194228
4241e2VP-CYWA3194228
4d20389H-AFKA3192592
aa79f6N774XFA3192019
86d607JA824PA3208835
e08594LV-HVTA3208574
86d629JA825PA3208847
7585b3RP-C8948A3205547
02a1b4TS-INUA3203827

Sunday, 16th Jun

0101deSU-GEUB78938802
76bd4a9V-OJJB78937131
c05219C-GFCIA3203286
a4bb8aN404ANA21N8758
4d21ea9H-QABB73844792

Saturday, 15th Jun

ace60cN930DZB73963539
a420afN365UPB76365788
4d012dLX-KCLB74435236
a2cf34N280NNE75L17000800
a7dbaaN605UXE75L17000802
4bb325TC-LYEB39M60066
a46e40N385DZA3218975

MySQL conditional updates

INSERT INTO daily_events
  (created_on, last_event_id, last_event_created_at)
VALUES
  ('2010-01-19', 23, '2010-01-19 10:23:11')
ON DUPLICATE KEY UPDATE
  last_event_id = IF(last_event_created_at < VALUES(last_event_created_at), VALUES(last_event_id), last_event_id),
  last_event_created_at = IF(last_event_created_at < VALUES(last_event_created_at), VALUES(last_event_created_at), last_event_created_at);

Source: https://thewebfellas.com/blog/conditional-duplicate-key-updates-with-mysql/

Back to Top