List:General Discussion« Previous MessageNext Message »
From:Max Anderson Date:May 9 2002 8:37pm
Subject:RE: MySQL GROUP BY Anomaly?
View as plain text  
I don't want to doubt you :-) but can you show us a select including the
time component?  I don't know how date comparison works in MySQL but here is
a test I ran in Oracle.  I inserted some dates into a table using sysdate
which include time information and inserted more records using
to_date('2002-05-09', 'dd-mon-yyyy') which does not include time
information.  These records are shown below.  Now if you run the two queries
you mentioned you also get records back because date comparison that does
noy explicitly include a time assumes 12:00:00.  I am thinking that if you
lool at your date fields closer you will find that some have different
timestamps.

I could be wrong but it's certainly a quick and easy comfirmation for you to
try.

  1* select to_char(martin, 'dd-mon-yyyy hh:mi:ss') from martin
SQL> /

TO_CHAR(MARTIN,'DD-M
--------------------
09-may-2002 02:28:14
09-may-2002 02:28:19
09-may-2002 02:28:20
09-may-2002 02:28:20
09-may-2002 02:28:21
09-may-2002 12:00:00
09-may-2002 12:00:00
09-may-2002 12:00:00
09-may-2002 12:00:00
09-may-2002 12:00:00

10 rows selected.

SQL> select * from martin where martin = '2002-05-09';

MARTIN
----------
2002-05-09
2002-05-09
2002-05-09
2002-05-09
2002-05-09

SQL> select * from martin where martin > '2002-05-09';

MARTIN
----------
2002-05-09
2002-05-09
2002-05-09
2002-05-09
2002-05-09

Martin Anderson
QA Engineer
ProfitLogic
Eleven Cambridge Center
Cambridge, MA 02142
t: 617.218.1946


-----Original Message-----
From: Jay Blanchard [mailto:jay.blanchard@stripped]
Sent: Thursday, May 09, 2002 1:23 PM
To: mysql@stripped
Subject: RE: MySQL GROUP BY Anomaly?


[snip]
Perhaps the time component of the date is different, hence you are getting
back what looks like duplicate rows but they're not really?
[/snip]

The time components are all the same. And if I say this in my query;

WHERE RecordDate = '2002-03-04' , it works (returns one row of data)

or if I do;

WHERE RecordDate > '2002-03-04' , 	it works

I am stumped.

Jay



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <mysql-thread108530@stripped>
To unsubscribe, e-mail
<mysql-unsubscribe-Martin.Anderson=bodoin.com@stripped>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Thread
Multiple tables in delete statement on Mysql 3Augey Mikus9 May
  • RE: Multiple tables in delete statement on Mysql 3Jay Blanchard9 May
    • Re: Multiple tables in delete statement on Mysql 3Augey Mikus9 May
      • RE: Multiple tables in delete statement on Mysql 3Jay Blanchard9 May
    • Re: Multiple tables in delete statement on Mysql 3Gelu Gogancea9 May
    • Re: Multiple tables in delete statement on Mysql 3Augey Mikus9 May
  • Re: Multiple tables in delete statement on Mysql 3Egor Egorov9 May
  • Re: Multiple tables in delete statement on Mysql 3Paul DuBois9 May
  • Re: Multiple tables in delete statement on Mysql 3Augey Mikus9 May
    • Re: Multiple tables in delete statement on Mysql 3Paul DuBois9 May
    • MySQL GROUP BY Anomaly?Jay Blanchard9 May
RE: MySQL GROUP BY Anomaly?Max Anderson9 May
  • RE: MySQL GROUP BY Anomaly?Jay Blanchard9 May
  • RE: MySQL GROUP BY Anomaly? SOLVEDJay Blanchard9 May
RE: MySQL GROUP BY Anomaly?Max Anderson9 May