更改Mysql列日期格式并执行查询

更改Mysql列日期格式并执行查询,mysql,sql,date,Mysql,Sql,Date,比如说 从产品中选择日期格式(日期(信用日期),“%Y-%m-%d”),其中日期(信用日期)>=日期“2012-11-02”和日期(信用日期)看起来您的信用日期是另一种日期格式的varchar类型,如果是,请尝试以下操作: select date_format(str_to_date(credit_date,'%d/%m/%Y'), '%Y-%m-%d') as dt from product where str_to_date(credit_date,'%d/%m/%Y') >

比如说



从产品中选择日期格式(日期(信用日期),“%Y-%m-%d”),其中日期(信用日期)>=日期“2012-11-02”和日期(信用日期)看起来您的信用日期是另一种日期格式的varchar类型,如果是,请尝试以下操作:

select date_format(str_to_date(credit_date,'%d/%m/%Y'), '%Y-%m-%d') as dt
  from product 
 where str_to_date(credit_date,'%d/%m/%Y') >= '2012-11-02'
   and str_to_date(credit_date,'%d/%m/%Y') <= '2013-11-02'
选择日期格式(str-to-date(贷方日期,'%d/%m/%Y'),'%Y-%m-%d')作为dt
从产品
其中str_to_date(贷方日期,'%d/%m/%Y')>='2012-11-02'

我不明白这个问题。信用卡日期的数据类型是什么?
select date_format(str_to_date(credit_date,'%d/%m/%Y'), '%Y-%m-%d') as dt
  from product 
 where str_to_date(credit_date,'%d/%m/%Y') >= '2012-11-02'
   and str_to_date(credit_date,'%d/%m/%Y') <= '2013-11-02'