[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: date problem
From:       Sammy Lau <sammy () team ! outblaze ! com>
Date:       2002-06-06 6:26:47
[Download RAW message or body]

-do you have any index covering this query?
-this is not a good practice to have function call(s) in the where
clause, since mysql will make the fucntion call for every rows scanned.
select count(*) as c
from users_table
where user_regdate > "2002-06-01 00:00:00"
-furthermore, in the where clause, >= is always better than >.
select count(*) as c
from users_table
where user_regdate >= "2002-06-01 00:00:01"

andy wrote:
> 
> Hi there,
> 
> I would like to count the users out of a mysql db who registered after a
> certain date.
> 
> The column I have in the db is a char and I do not want to change this
> anymore.
> This is how a typical entry looks like: May 29, 2002
> 
> This is how I tryed it:
> 
> // while '10...' is unix timestamp june 1, 02
> SELECT COUNT(*) AS c
> FROM users_table
> WHERE UNIX_TIMESTAMP( user_regdate ) > '1022882400'
> 
> Thanx for any help on that,
> 
> andy
> 
> query
> 
> ---------------------------------------------------------------------
> 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-thread111151@lists.mysql.com>
> To unsubscribe, e-mail <mysql-unsubscribe-sammy=team.outblaze.com@lists.mysql.com>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-- 
Sammy Lau
mailto: sammy@team.outblaze.com
- Tell me what you want and I'll tell you how you can live without it.

---------------------------------------------------------------------
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-thread111152@lists.mysql.com>
To unsubscribe, e-mail <mysql-unsubscribe-mysql=progressive-comp.com@lists.mysql.com>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic