Thank you very much, that indeed did the trick.

Concerning datetime type:
Eg. in a forum if someone posts a message the date and the time is stored
and shown of that message.
I suppose they use timestamp in that case?


-----Oorspronkelijk bericht-----
Van: Gabriel PREDA [mailto:[EMAIL PROTECTED] 
Verzonden: vrijdag 18 februari 2005 12:30
Aan: [EMAIL PROTECTED]; mysql@lists.mysql.com
Onderwerp: Re: compare dates

Let me assure you that DATETIME is the worst choice ever... because it need
8 bytes per record...
TIMESTAMP uses only 4
DATE uses only 3, so does TIME
YEAR is the smallest... 1 byte.

You can do:
    SELECT * FROM activities WHERE act_date >= NOW()

But for optimization... you should not compute in WHERE... so this is
faster.. .but there are 2 queries:
    SET @this_moment = NOW();
    SELECT * FROM activities WHERE act_date >= @this_moment

Gabriel PREDA
www.amr.ro


  ----- Original Message ----- 
  From: Reinhart Viane
  To: mysql@lists.mysql.com
  Sent: Friday, February 18, 2005 1:10 PM
  Subject: compare dates


  Hey list


  I need a query like this:

  Select * from activities where act_date = today or any day in the future



  I have made it work like this:

  Sselect * from activities where UNIX_TIMESTAMP()< UNIX_TIMESTAMP(act_date)



  Problem is with this thing I have to manually add 23:59:59 to each
activity date I enter in the database.


  I'm sure there is a better way so I can set my column type to DATE instead
of DATETIME now and use a better query.

  Any help?



  Thx

  Reinhart



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.8 - Release Date: 14/02/2005


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to