I'm using MySql 5.5,
I am using the following query on a radius accounting table.
query1:
SELECT * FROM database.table WHERE framedipaddress='192.168.1.1' and '2011-09-09' BETWEEN acctstarttime AND acctstoptime;
The acctstarttime
and acctstoptime
fields are type datetime
, formatted as YEAR-MT-DY HR:MN:SC
.
Using query2 reveals my results of query1 are not always accurate, query1 sometimes will return nothing or an incorrect row.
query2:
SELECT * FROM database.table WHERE framedipaddress = '192.168.1.1' ORDER BY acctstarttime DESC LIMIT 0, 400;
Is there a different method to query two datetime
, fields, or is it the database sanity/data is the issue?
Any guidance to the errors in my logic are welcome.
Here is the question for the query I have now.