You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working with SeaORM and attempting to perform an UPDATE SET CASE WHEN ELSE operation where I need the ELSE part to reference a column instead of a static value. However, I am having trouble expressing this with the current API.
Normally, in SQL, we can write something like this:
UPDATE my_table
SET
c1 = CASE
WHEN id ='record1' THEN new_value_for_c1
ELSE c1
END,
c2 = CASE
WHEN id ='record2' THEN new_value_for_c2
ELSE c2
END,
c3 = CASE
WHEN id ='record3' THEN new_value_for_c3
ELSE c3
END
WHERE id IN ('record1', 'record2', 'record3');
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am working with SeaORM and attempting to perform an
UPDATE SET CASE WHEN ELSE
operation where I need theELSE
part to reference a column instead of a static value. However, I am having trouble expressing this with the current API.Normally, in SQL, we can write something like this:
In SeaORM, I can't figure out how to express it.
Beta Was this translation helpful? Give feedback.
All reactions