我需要忽略DateTime列中的时间部分来比较MySQL中的日期。我已经尝试了下面的SQL。SELECT * FROM order_table where order_date=date_format('2012-05-03', '%Y-%m-%d');
即使MySQL表中有日期2012-05在MySQL中比较日期时,如何忽略DateTime字段中的时间部分?
我试图在laravel应用程序中统计未读消息,但是我的"last_viewed“列包含"last_viewed (int) 11”中存储的“原始”时间(以秒为单位),而我的"created_at“列包含mysql时间戳,因此我无法在mysql语句中比较它们。这是我比较它们的方式,但这有点像意大利面class Helper {
public static function count_unread_messages