Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张表,其中字段“CreatedTime”作为日期时间文件(例如:2012-09-18 13:01:33)。我想用 CreatedTime 作为“AM”(即在 12 之前)获取该表中的所有行。我该如何为此编写查询?
SELECT * FROM table_name where date_format(CreatedTime,'%p') = 'AM'
这个应该工作:
SELECT * FROM table WHERE hour(CreatedTime) < 12