MySQL: Update If exist

Source: https://stackoverflow.com/questions/46628616/ignore-update-data-if-exist-in-mysql-by-node-js

https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html

Fixed it by :
ON DUPLICATE KEY UPDATE

connection.connect( function( err ) {

    connection.query( "INSERT INTO real_user SET ? ON DUPLICATE KEY UPDATE updated_at = '" + data.created_at
     + "', request_count = '" + data.request_count + "'", 
        data,  function( err, res ) {
            connection.end();
        });

    });

Không có nhận xét nào:

StaticImage

  import React , { useEffect , useRef } from "react" import { StaticImage } from "gatsby-plugin-image" impor...