首页  >  问答  >  正文

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

迷茫迷茫2742 天前1040

全部回复(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
  • 取消回复