I'm using MySql 5.5.
I need to find a userid on a date with a particular ip address.
The fields are userid, ipaddress, startdate, enddate.
So for instance I am looking for a userid with ip address 192.168.1.1 on Sep 12 2011.
the query would be similar
select * from database where ipaddress='192.168.1.1' and 2011-12-09 is in(startdate and enddate);
Any help to pointing out this logic flaw is welcome. Thank you.
It's not very clear if you want:
'2011-12-09' BETWEEN startdate AND enddate
or:
'2011-12-09' = startdate AND '2011-12-09' = enddate