0
I have a following table:
+----+-----------------------+-----------------------+
| id | description | created_at |
+----+-----------------------+-----------------------+
| 5 | Game Of Thrones | 2017-03-14 17:45:12 |
| 4 | Breaking Bad | 2017-03-13 13:45:12 |
| 3 | Vikings | 2017-03-12 12:45:12 |
| 2 | How I Met Your Mother | 2017-03-10 18:45:12 |
| 1 | Mr. Robot | 2017-03-09 11:45:12 |
+----+-----------------------+ ----------------------+
Table creation:
CREATE TABLE myTable(
int INTEGER PRIMARY KEY AUTOINCREMENT,
description TEXT,
created_at DATETIME)
This table is incremented every day at a random time. I would like a query which checks whether a new item has already been registered today. In this case there would still be no registration as today is 2017-03-15 11:14:22
, then I could register a new item.
Since it is possible to get the last registered item using the query:
select * from myTable order by created_at desc limit 1
How could I verify that the last item was registered today based on the current time?
@Acklay, doing a max on id, does not solve?
– Jefferson Rudolf
try this way select Description from myTable Where created_at = datetime()
– Jefferson Rudolf