Thread: how to write a function?

how to write a function?

From
"Ireneusz Kramarz"
Date:
Hi, I got a problem with writing a proper function.
I got a table 'stock' with fields like 'stock' and 'sold'.
Now, I need a function that would decrease the number in 'stock', when I insert a certain value into 'sold', by that certain value.
 
eg. stock=40 sold=0
      I insert ' 2' into sold, and it should be like that
      stock=38 sold=2
 
How to do this? I'm really green in the triggers stuff, so please send me some examples for solving this problem.
 
I apreciate your help so much,     iron