Hi,

I am new to mySQL, so I need some help. 
I have a table, which has record structure like this:

- customer
- name
- register_date
- expired

Every day, I add some records, new customers. The field 'expired' is just a flag, 
either '1' or
'0'. 
If register_date is 3 months ago then expired = 1.

The format of register_date is unixtime, or Epoch. 

How can I update the entire database, for setting the expired field ? 

  now = current_unixtime();
  threemonths = 3 * 30 * 24 * 60 * 60;

  select * from table_name where register_date + threemonths < now

How to construct the proper select statement ? I use VARCHAR for register_date.

  select ....
  for i = 0 to number_of_rows do
      update table_name set expired = 1;

I just could not think how to implement this. 

I need some example code how to update some records in table like in my situation. 

I use C ... or Perl 

Thanks. 

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------------------------------------------------
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

Reply via email to