Reputation: 101
I have a colomn name LastOnline which is define as DataType=Datetime I enter him the values as
update office.router set LastOnline=NOW() where IP=deviceip;
working as should
but how do I compare it to check only devices that aren't online today without the time , just the date part of the timestamp?
so when he will get ping from him today, he will try to ping it the next day?
I have try
SELECT
*
FROM office.router
where
LastOnline != Date(curdate())
but it didn't work - gave me the full list what is wrong?
Upvotes: 0
Views: 224
Reputation: 872
You haven't to do date of curdate() because curdate is already a date:
SELECT * FROM sample.table1
where Date(LastOnline) = curdate()
Upvotes: 1
Reputation: 101
thanks , this is the correct way to write this:
SELECT
*
FROM sample.table1
where
Date(LastOnline) = Date(curdate())
working
Upvotes: 0