-1

I'd like to update the first price record for each stock without changing other records. The problem is I cannot find an efficient way to set the conditions concisely as a stock id column contains various stocks. Any suggestions on function use?

btw I've checked similar questions, but it seems the answers do not apply to this situation.

YaN
  • 407
  • 1
  • 6

1 Answers1

0

Use functioniif together with rowNo so you can update the given information easily:

pp = table(`a`a`a`b`b`c`c`c`c as id, 1..9 as price)
update pp set price = iif(rowNo(price)==0,0,price) context by id

enter image description here

winnie
  • 183
  • 1
  • 6