0
我試圖根據date_of_order和time_of_order獲得近5個訂單通過下表中領域,這兩個領域的數據類型是varchar並且這裏的order_child_id是一些不按順序存儲的隨機數。如何獲得最近根據日期和時間5場這是爲varchar
如何爲此編寫查詢?
order_details_child表:
+------------------+------------+---------------+---------------+
| order_child_id | vendor_id | date_of_order | time_of_order |
+------------------+------------+---------------+---------------+
| 2000010313044428 | 5060091713 | 2015-03-11 | 16:44:28 |
| 2000010313044920 | 5060091713 | 2015-03-13 | 16:49:20 |
| 2000010313044951 | 5060091713 | 2015-03-11 | 16:49:51 |
| 2002880313043941 | 5000818755 | 2015-03-13 | 16:39:41 |
| 2002880313044029 | 5000818755 | 2015-03-12 | 16:40:29 |
| 3000010313044555 | 5060091713 | 2015-03-12 | 16:45:55 |
| 4000010313044555 | 5000818755 | 2015-03-13 | 16:45:55 |
+------------------+------------+---------------+---------------+