1.传统的方法
SELECT * FROM customer lastlogintime >= '2015-01-01 13:50:42' AND lastlogintime <= '2015-02-06 00:00:00' ORDER BY ID DESC
但是传统的方法效率很低。
2.采用UNIX_TIMESTAMP,能有效的提高效率。
SELECT * FROM customer WHERE UNIX_TIMESTAMP(lastlogintime) >= UNIX_TIMESTAMP('2015-01-01 13:50:42') AND UNIX_TIMESTAMP(lastlogintime) <= UNIX_TIMESTAMP('2015-02-06 00:00:00') ORDER BY ID DESC