Hi all: 

Having some doubts with sql select queries here : 

Right now, I have a "student" and a  "withdraw" tables. 
For example, when student "John" has withdrawn, his name will be inserted 
into "withdraw" table but John's record will be kept in "student" table for a 
period of 30 days before it is deleted from "student" table. In the meantime, 
in "student" table, the status for John should be set to "0" (inactive). 
Wonder the solutions I have mentioned is possible? And if so, how shld i go 
about doing it ??....Hope to get some help really soon...Thanks in advance! 


    student table                          withdraw table 
-----------------------           ------------------------------------- 
|student_name | status |            student_name | withdraw_reason 
-----------------------           ------------------------------------- 
|   John      |    0   |               John      |  migrate 
-----------------------           ------------------------------------- 
|   James     |    1   | 
----------------------- 


Regards, 
Irin Chiang.

-------------------------------------------------------------------------------

Hi There, 

   I would have a delete_at column on the table and once a row is queued 
for delete, I would update this row with the date n days from now. I would 
then have a daily cron that went looking for rows to delete on that day 

Cheers 

   Chris 



-------------------------------------------------------------------------------





Hi, 

yah that's what I'm looking for, creating a "cronjob" whereby this "cron" will 
automatically delete the record once 30 days is up...maybe using something 
like that:

"DELETE FROM tablename
 WHERE (DATA_SUB(NOW()), INTERVAL 30 DAY) > name_of_date_column; "

But now the point is, what if the student decided to cancel his withdrawal 
within these 30 days, (that was also the reason why to keep the record for 30 
before deletion ) , how shld i go about updating the status of the student 
to "1" (active)again ???And, how to cancel the "cronjob" so that it will not 
delete the student record after 30 days???I hope I have made myself clear...

Any useful links that teaches how to create a "Cronjob"????


Regards, 
Irin Chiang.

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

Reply via email to