MySQL Forums
Forum List  »  Partitioning

After partition, query returns wrong result.
Posted by: yansheng lin
Date: May 19, 2006 12:23PM

Hi, I set up monthly partition on the log_hour field for one of my tables, books. When I do a select on the max(log_hour), if I only specify one condition in my where clause, everything looks fine. But if I specify two conditions in the where clause, it gave me the wrong result back. The partitioning function is very simple -- Partition By Range (year(log_hour)*100+month(log_hour). What's going on?

mysql> select max(log_hour) from books where
mysql> book_id = 266 and department_id = 1;
+---------------------+
| max(log_hour) |
+---------------------+
| 2006-04-30 23:00:00 |
+---------------------+
1 row in set (0.07 sec)

mysql> select max(log_hour) from books where
mysql> department_id = 1;
+---------------------+
| max(log_hour) |
+---------------------+
| 2006-05-19 08:00:00 |
+---------------------+
1 row in set (0.07 sec)

mysql> select max(log_hour) from books where
mysql> book_id = 266;
+---------------------+
| max(log_hour) |
+---------------------+
| 2006-05-19 08:00:00 |
+---------------------+
1 row in set (0.07 sec)

mysql> select max(log_hour) from books where
mysql> book_id = 266 and department_id = 1;
+---------------------+
| max(log_hour) |
+---------------------+
| 2006-04-30 23:00:00 |
+---------------------+
1 row in set (0.07 sec)

Options: ReplyQuote


Subject
Views
Written By
Posted
After partition, query returns wrong result.
3583
May 19, 2006 12:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.