weird date behavior

2001-03-01 Thread Daren Cotter

I have a field in my table that stores the date a member has signed up...i
run a query using distinct to show me how many members signup each day.
Yesterday, our server crashed, and today i am seeing weird behavior with
mysql:

SELECT count(*) FROM members WHERE signup_date = now();
122
SELECT count(*) FROM members;
108984

INSERT INTO members (blah blah) VALUES (blah blah);

SELECT count(*) FROM members WHERE signup_date = now();
122
SELECT count(*) FROM members;
108985

The total count is incremented, but not for today's date. Anyone have any
ideas?


-
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 [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: weird date behavior

2001-03-01 Thread Aaron Weiker

When you specify now it is giving a date and a time. So if you do your query
it may be checking the date and time in the signup_date field and if it
doesn't find a time it just matches the date. What I would do if you want
results for the day and not the exact time is to change the query so that it
only tries to match the day/month/year w/out the timestamp. I noticed some
similar things in Microsoft SQL but haven't worked w/ MySQL enough to know
that this is the case. So this is all theory.

Aaron Weiker

-Original Message-
From: Daren Cotter [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 01, 2001 4:39 PM
To: [EMAIL PROTECTED]
Subject: weird date behavior


I have a field in my table that stores the date a member has signed up...i
run a query using distinct to show me how many members signup each day.
Yesterday, our server crashed, and today i am seeing weird behavior with
mysql:

SELECT count(*) FROM members WHERE signup_date = now();
122
SELECT count(*) FROM members;
108984

INSERT INTO members (blah blah) VALUES (blah blah);

SELECT count(*) FROM members WHERE signup_date = now();
122
SELECT count(*) FROM members;
108985

The total count is incremented, but not for today's date. Anyone have any
ideas?


-
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 [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php