只是需要一些想法選擇Count行然後更新值
有沒有一種方法可以讓我選擇計數,然後更新它的價值呢?
這是我的代碼進行編輯。
我得到我的表中的新郵件的數量message
select count(id) as new from message where owner_id = '1' and status = '1' and isRecieve = '0'
當我得到消息的數量,我希望它設置所有message
得到了select
查詢isRecieve = 1
有沒有辦法,一旦我查詢我updte所有isRecieve 1?
像
select count(id) as new from message where owner_id = '1' and status = '1' and isRecieve = '0' then update isRecieve = 1
感謝。