我已经关注了 Mysql 查询:
select str_to_date((select distinct cast(substr(tb2.sub1,1,4) AS CHAR) as year from (
SELECT SUBSTRING_INDEX(file_name,'_',-1) as sub1 from table2) as tb2) , '%Y')
这是正确的,因为 mysqlworkbench 返回绿旗但没有输出。
你可以帮帮我吗?
我已经关注了 Mysql 查询:
select str_to_date((select distinct cast(substr(tb2.sub1,1,4) AS CHAR) as year from (
SELECT SUBSTRING_INDEX(file_name,'_',-1) as sub1 from table2) as tb2) , '%Y')
这是正确的,因为 mysqlworkbench 返回绿旗但没有输出。
你可以帮帮我吗?
表达方式
select str_to_date('2007', '%Y')
返回2007-00-00
。一些 MySQL 服务器设置为不允许无效日期。尝试使用
select makedate('2007', 1)
反而。这将为您提供 的有效日期2007-01-01
。
我将其留给您编辑查询以进行更改。