Think before you speak, read before you think.

mysql between用法

by

in

mysql中的between and用于将一定范围内的数据取出,包含了边界值, 查看ID号在20至50之间的用户,包含20和50:

SELECT * FROM user WHERE uid BETWEEN 20 AND 50

还可以查看在字符范围内的,应该是按ASCII码排序

SELECT * FROM user WHERE name BETWEEN a AND e;

between and 比较时间,可以是从1970-01-01 00:00:00的秒数,如1387210733,可以是date格式,也可以是datetime格式。如

SELECT * FROM user WHERE rtime BETWEEN '2010-08-10' AND '2013-12-10';

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *