节气查询sql

查询当前节气是否在最近的节气的两天内

1.节气对照表;

2.sql

select count(*) as total from( SELECT * FROM tzbs2.solarterm where to_days(date) >= to_days('2020-01-07 16:56:06')-1 LIMIT 1 )tmp where to_days(date) -  to_days('2020-01-06 16:56:06') < 2
and   to_days('2020-01-08 16:56:06') - to_days(date) >= 0 
发布了53 篇原创文章 · 获赞 3 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/Min_Chander/article/details/103861357