0
我需要一個如果,那麼,否則查詢在MySQL中,
嘗試了下面,Mysql查詢更新行如果存在?
if exists(select * from data_table where user_id =1 and link_id = 1) then update data_table set is_view = 1 where user_id = 1 else insert into data_table...
什麼是做這種正確的方法是什麼?
的可能重複[SQL - IF EXISTS UPDATE ELSE INSERT INTO](http://stackoverflow.com/questions/15383852/sql-if-exists-update-else-insert-into) –