I have a graphql type which I would like to update based on the value of one column. For example the type has the following columns: id, col1, col2, col3 so I would like to update col3 if only if col1 has a value. I am using react as frontend and HASURA as backend
Asked
Active
Viewed 838 times
1 Answers
0
You can use the _is_null
statement to check if the column has a value or not:
mutation updateMutation {
update_myTable(where: {id: {_eq: "id"}, _and: {col_1: {_is_null: false}}},
_set: {col_3: "new value"}) {
affected_rows
}
}

Soheil Pourbafrani
- 3,249
- 3
- 32
- 69