[前][次][番号順一覧][スレッド一覧]

mysql:13123

From: "Akimasa" <"Akimasa" <asamika2og@xxxxxxxxxx>>
Date: Wed, 28 Jun 2006 16:29:04 +0900
Subject: [mysql 13123] Re: 日付型・日付時刻型の比較について

大月です
お手数お掛けします。

アドバイスありがとうございます。
おっ、と思ったのですが、

mysql> INSERT INTO nitiji_tb (nitiji) VALUES
    -> ('2006-06-30 12:00:00');
Query OK, 1 row affected (0.00 sec)

のようなレコードがある場合、

mysql> SELECT * FROM nitiji_tb
    ->   WHERE nitiji BETWEEN '2006-6-1 00:00:00'
    ->                    AND '2006-6-30 23:59:59';
+---------------------+
| nitiji              |
+---------------------+
| 2006-06-01 00:00:00 |
| 2006-06-10 00:00:00 |
| 2006-06-30 12:00:00 |
+---------------------+
3 rows in set (0.00 sec)

mysql> SELECT * FROM nitiji_tb
    ->   WHERE nitiji BETWEEN '2006-6-1'
    ->                    AND '2006-6-30';
+---------------------+
| nitiji              |
+---------------------+
| 2006-06-01 00:00:00 |
| 2006-06-10 00:00:00 |
+---------------------+
2 rows in set (0.00 sec)

のような違いが出てしまいます。

--
大月
--------------------------------------
Let's start Yahoo! Auction  -  Free Campaign Now!
http://pr.mail.yahoo.co.jp/auction/

[前][次][番号順一覧][スレッド一覧]

     13118 2006-06-28 13:20 ["Akimasa" <asamika2o] 日付型・日付時刻型の比較について        
     13119 2006-06-28 14:24 ┣["片寄白王" <katayose]                                       
     13120 2006-06-28 14:50 ┃┗["Akimasa" <asamika2o]                                     
     13122 2006-06-28 16:13 ┃ ┗["片寄白王" <katayose]                                   
->   13123 2006-06-28 16:29 ┃  ┗["Akimasa" <asamika2o]                                 
     13124 2006-06-28 17:16 ┃   ┗["片寄白王" <katayose]                               
     13125 2006-06-28 17:32 ┃    ┗["Akimasa" <asamika2o]                             
     13126 2006-06-28 17:48 ┗[SUGAWARA Hajime <sug]                                       
     13127 2006-06-28 18:37  ┗["Akimasa" <asamika2o]                                     
     13128 2006-06-28 19:16   ┗[SUGAWARA Hajime <sug]                                   
     13129 2006-06-28 19:49    ┣[<milk_coffee_2004jp@]                                 
     13130 2006-06-28 22:48    ┗["Akimasa" <asamika2o]