简体   繁体   中英

Insert or Update value of one column against specific column in room DB android

I need to insert or update a value of one column against specific column using Room DB like if column 'id' is 2 then put value inside column 'answer'. I need to use WHERE clause but do not know the exact syntax and way.

@Insert @Query(INSERT INTO "+ TABLE +" WHERE id =:id") long insertSkillValue(String id,String value);

I need to know the missing part of query

@Query("UPDATE " + TABLE_NAME + " SET column_name1=:value WHERE id=:id")
long insertSkillValue(String id, String value); 

Something like this?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM