In DolphindDB, is it feasible to use the SET...IF statement with UPDATE in SQL queries?

19 views Asked by At

Does DolphinDB support the following script?

update tmp set exchangecd='XSHG' if exchangecd='SH' set exchangecd='XSHE' if exchangecd='sz'
1

There are 1 answers

0
Shena On BEST ANSWER

DolphinDB does not support the IF statement, but you can use the CASE statement with WHEN...THEN..., as shown in the following script:

UPDATE tmp SET col1 = CASE WHEN col1 = 'SH' THEN 'hello1' WHEN col1 = 'SZ' THEN 'hello2'    ELSE col1END;