首頁  >  問答  >  主體

mysql - 请问数据库字段为年月日,传进的参数为月,怎么查询那个月所对应的数据

迷茫迷茫2742 天前1037

全部回覆(1)我來回復

  • 伊谢尔伦

    伊谢尔伦2017-04-17 16:52:28

    select * from table WHERE date_format(date,'%Y-%m') = '2017-3'

    如果需要前面加年份的話,可以使用資料庫函數date_format
    格式可以參考這篇文章
    http://blog.csdn.net/kangbrot...

    回覆
    0
  • 取消回覆