If mysql has an id, set data to increase by 1. If no id exists, add it. Java month Calculation Comparison, mysql. java

Source: Internet
Author: User

If mysql has an id, set data to increase by 1. If no id exists, add it. Java month Calculation Comparison, mysql. java

</pre><pre name="code" class="sql">INSERT INTO invite_rejectlog_num (player_id,MONTH,count,last_modify_time)VALUES (#{playerId},#{month},#{count},#{lastModifyTime})ON DUPLICATE KEY UPDATE count=count+1;


The unique constraint id and month are required.



Calculation and comparison of ava months

Calendar calDelM = Calendar. getInstance (); calDelM. set (Calendar. MONTH, 0); System. out. println (calDelM. get (Calendar. MONTH); calDelM. add (Calendar. MONTH,-1); System. out. println (calDelM. get (Calendar. MONTH); // ix traverses the MONTH int isdel = calDelM. get (Calendar. MONTH); int ix = 8; // The minimum cache MONTH: Calendar ar calDelM2 = Calendar. getInstance (); calDelM2.set (Calendar. MONTH, ix); ix = calDelM2.get (Calendar. MONTH); // ix <isdelCale Ndar calDelM3 = Calendar. getInstance (); calDelM3.set (Calendar. MONTH, calDelM. get (Calendar. MONTH); for (; calDelM2.compareTo (calDelM3 )! =-1;) {System. out. println ("===================="); System. out. println ("calDelM2:" + calDelM2.get (Calendar. MONTH) + "" + "calDelM:" + calDelM. get (Calendar. MONTH) + "calDelM3:" + calDelM3.get (Calendar. MONTH); System. out. println (calDelM2.compareTo (calDelM3); calDelM. add (Calendar. MONTH,-1); isdel = calDelM. get (Calendar. MONTH); calDelM3.set (Calendar. MONTH, calDelM. get (Calendar. MONTH); System. out. println ("del:" + isdel); System. out. println ("====================== ");}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.