Is this even possible?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Local Reaction
Forum Newbie
Posts: 1
Joined: Mon Dec 15, 2003 7:29 pm

Is this even possible?

Post by Local Reaction »

Here is my situation, I need to have mysql do a COUNT(*) in "column C" to see how many times lets say the number 5 appears in that column, and if that number 5 appears more than lets say 10 times, I need for that number 5 to correspond to "row 5" and change another column, "column B" in "row 5" to lets say the number 50. Got it? Anyone know how to do this? Ive been trying to figure it out in my head for a week but I just dont know how to do it. I have done extensive google searches but have come up empty handed.

Is this sort of thing even possible to do?

I deeply thank in advance anyone who can help me out.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Could you provide more information on why you want to do this - it's not generally a good idea to store the results of calculations on db data in the database as it's often difficult to maintain. Maybe there's another way of structuring the database?

Mac
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Sure. It's a snap with the [php_man]mysql[/php_man] functions and some long hours coding with trusty caffine by your side. :)
Paddy
Forum Contributor
Posts: 244
Joined: Wed Jun 11, 2003 8:16 pm
Location: Hobart, Tas, Aussie
Contact:

Post by Paddy »

twigletmac wrote:Could you provide more information on why you want to do this - it's not generally a good idea to store the results of calculations on db data in the database as it's often difficult to maintain. Maybe there's another way of structuring the database?

Mac
I might be wrong but a database is not normalised with calculated data in it. Just another point.
Post Reply