Gossamer Forum
Home : General : Databases and SQL :

Mysql update with cron?

Quote Reply
Mysql update with cron?
can i have a cron job that does this? :

say i have 3 columns in a table

col1 percent col3
100 20.0
95 20.0
75 15.0

i need to take values from col1 (100,95,75) and get the percentage (20%,20%,15%) of those values. then update col3 to reflect the percentage ie; 20% of 100 =20 (col3)

but, only the rows with no value in col3 need to be updated

am i making sense?
Quote Reply
Re: [kewlrobert] Mysql update with cron? In reply to
You can write your codes into a shell (sh) file and then use crontab to execute the sh file.

But in terms of setting conditions via WHERE clause statements, it may be better to write a script and then run the script via crontab.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] Mysql update with cron? In reply to
i'm just not sure how to write the script
Quote Reply
Re: [kewlrobert] Mysql update with cron? In reply to
Search the Internet Technologies forum for "crontab shell MySQL".

I provided some example codes for doing something similar to what you want in that forum about a month ago.
========================================
Buh Bye!

Cheers,
Me