MySQL Forums
Forum List  »  Newbie

Re: UPDATE a field SEVERAL times in 1 UPDATE
Posted by: Bigcrime Crimebig
Date: August 19, 2010 08:37PM

but please, just imaginate you want to get a result:

From this:

id......users......trans.....relationed.....fills
1.......David......5.........Carl................0
2.......John.......6.........Carl................0
3.......Carl.......2.........nobody..............1
4.......Liss.......4.........David...............0

To This:

id......users......trans.....relationed.....fills
1.......David......6.........Carl................0
2.......John.......6.........Carl................0
3.......Carl.......4.........nobody..............1
4.......Liss.......4.........David...............0

I reduce -1 to fills with a cronjob every month and when it gets to 0
What I raised to you have to happen:

sum +1 in trans to relationed of the users who got fills 0.(remember relationed are users)

I dont know how can I solve this problem by creating other table :(.

I think the only way to solve this problem is getting a way from mysql to recognize each relationed that is repeated and group them but Im so newbie, Im consulting differents website but I cant find a way, I read about subquery and stored procedure but I still without an answer.

if you understood what I want to get plz help me, thats all, there is nothing more, thats the info and what I explained is what I want.

thanks alot for all answers and info.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.