数据库字段 time=2019-09-09 根据 year =2019,month=9 如何查询 2019 年 9 月的数据呢?
1
finaldusk 2019 年 12 月 2 日
time>=2019-09-01 and time<2019-10-01
|
2
arthas2234 2019 年 12 月 2 日
date_format(time, '%Y%m') = '201909'
|
3
changdy 2019 年 12 月 2 日
@arthas2234 2333 这样查询 不怕数据库崩溃吗...
|
4
qiayue PRO 1 楼 2 楼都可以实现,但是如果数据量大,建议用 1 楼方法。
甚至可以改表,增加 year,month 字段 |
5
Orenoid 2019 年 12 月 2 日
不是有 year 和 month 函数吗
|
6
arthas2234 2019 年 12 月 2 日 @changdy 楼主没说数据量有多大,但是问这个问题,默认是做作业了
|
7
chickenJuicer 2019 年 12 月 2 日
要不你直接 like 吧...
|
8
changdy 2019 年 12 月 2 日
|
9
shaweren OP 感谢各位大佬 /
<BR> month(stime)='$month' AND year(stime)='$year' <br>解决办法 |
10
aapon 2019 年 12 月 2 日 via iPhone
|
11
areless 2019 年 12 月 2 日 via Android
unix 时间戳不好用吗。。。
|
13
ganning 2019 年 12 月 3 日
更倾向于 1 楼的方法。最简单的往往是最高效的。
|