使用dataadd函数。http://dev.mysql.com/doc/refman/5.1/zh/index.html建议下载mySQL帮助手册。其中有所有函数的使用介绍。

解决方案 »

  1.   

    错了,是  DATE_ADD() 或 ADDDATE()ADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days) When invoked with the INTERVAL form of the second argument, ADDDATE() is a synonym for DATE_ADD(). The related function SUBDATE() is a synonym for DATE_SUB(). For information on the INTERVAL unit argument, see the discussion for DATE_ADD(). mysql> SELECT DATE_ADD('1998-01-02', INTERVAL 31 DAY);
            -> '1998-02-02'
    mysql> SELECT ADDDATE('1998-01-02', INTERVAL 31 DAY);
            -> '1998-02-02'When invoked with the days form of the second argument, MySQL treats it as an integer number of days to be added to expr. mysql> SELECT ADDDATE('1998-01-02', 31);
            -> '1998-02-02'
      

  2.   

    string sql = "select sum(ticketPrice) from wapMovie where telephone = '" + Session["userphone"] + "' and DATE_ADD(ticketDate, Interval 2 month) >= now()";
     
            MySQLCommand commn = new MySQLCommand(sql, conn); 
          
            if((Convert.ToInt32(commn.ExecuteScalar()>=80))) 
    跟楼上差不多,更细化了一些