我正在使用 MySql 5.5,
我在半径记帐表上使用以下查询。
查询1:
SELECT * FROM database.table WHERE framedipaddress='192.168.1.1' and '2011-09-09' BETWEEN acctstarttime AND acctstoptime;
和字段是 type acctstarttime
,格式为.acctstoptime
datetime
YEAR-MT-DY HR:MN:SC
使用 query2 显示我的 query1 的结果并不总是准确的,query1 有时会返回任何内容或不正确的行。
查询2:
SELECT * FROM database.table WHERE framedipaddress = '192.168.1.1' ORDER BY acctstarttime DESC LIMIT 0, 400;
是否有不同的方法来查询两个datetime
字段,或者是数据库健全性/数据是问题吗?
欢迎对我的逻辑中的错误提供任何指导。
这是我现在查询的问题。