/*Column Information For - month*/ ------------------------------------------Field Type Collation Null Key Default Extra ------- ---------------- -------------- ------ ------ ------- -------------- id int(10) unsigned (NULL) NO PRI (NULL) auto_increment userid int(20) (NULL) NO 0 month varchar(8) gbk_chinese_ci NO date varchar(4) gbk_chinese_ci NO dateall int(4) (NULL) NO 0 dateip int(4) (NULL) NO 0
select * from tt where year(字段)=2008 and month(字段)=5 and day(字段)<=10
from yourtable
where concat(`year-month`,'-',`day`) between '2008-01-20' and '2008-02-19'
[align=center]==== 思想重于技巧 ====
[/align]
[align=center]==== 思想重于技巧 ====
[/align]
------------------------------------------Field Type Collation Null Key Default Extra
------- ---------------- -------------- ------ ------ ------- --------------
id int(10) unsigned (NULL) NO PRI (NULL) auto_increment
userid int(20) (NULL) NO 0
month varchar(8) gbk_chinese_ci NO
date varchar(4) gbk_chinese_ci NO
dateall int(4) (NULL) NO 0
dateip int(4) (NULL) NO 0
不好意思,没把问题提清楚,这个是表结构
month里的数据是如 2008-01 这样的
date里的是 01 这样的
where concat(`month`,'-',`date`) between '2008-01-20' and '2008-02-19';这样就行了。
[align=center]==== 思想重于技巧 ====
[/align]