Jump to content

mysql explode sum


rugzo

Recommended Posts

Hi,

 

i have a row which should be updated by every query.

 

id  sum

0    1

 

every time i run the query it should update the sum plus the new value.

 

update x set sum = sum + $newvalue.

 

this works fine.

 

but how can i do that with explode. i need this because this column has to values which are seperated with "_".

like 120_140.

is it possible with sql query that i can do that.

 

as example the current values are

 

120_140

 

the new values are 10_5

 

= 120+10_140+5

130_145

?

 

i know i can do that with php easyly but it must be done via the sql query in my structure ?

 

thanks...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.