Обсуждение: how to write a function?

Поиск
Список
Период
Сортировка

how to write a function?

От
"Ireneusz Kramarz"
Дата:
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