MySql get previous rows byTimeStamp
I have:
Table infoUpdate
+-------+-----------+-----------+-----------+-----------+
| idKey1| idKey2 | date_Update | DayWeek |
+-------+-----------+-----------+-----------+-----------+
| 1 | 3 | 2013.01.01 15:00:00 | 2 |
| 1 | 3 | 2013.01.01 18:00:00 | 2 |
| 1 | 3 | 2013.01.02 15:00:00 | 3 |
| 1 | 3 | 2013.01.02 18:00:00 | 3 |
| 1 | 3 | 2013.01.03 15:00:00 | 4 |
| 1 | 3 | 2013.01.03 18:00:00 | 4 |
+-------+-----------+-----------+-----------+-----------+
How to obtain only previous rows by timeStamp
Select * FROM infoUpdate if where date_Update <='2013.01.03 18:00:00';
This is what I'm looking at obtaining:
+-------+-----------+-----------+-----------+-----------+
| idKey1| idKey2 | date_Update | DayWeek |
+-------+-----------+-----------+-----------+-----------+
| 1 | 3 | 2013.01.01 18:00:00 | 2 |
| 1 | 3 | 2013.01.02 18:00:00 | 3 |
| 1 | 3 | 2013.01.03 18:00:00 | 4 |
+-------+-----------+-----------+-----------+-----------+
No comments:
Post a Comment