简体   繁体   English

用唯一的行ID更新mysql表行

[英]update mysql table row with unique row id

I want to update a table row within mysql that doesn't have row id's. 我想更新没有行ID的mysql中的表行。

The table name is "unit_status" 表名称为“ unit_status”

unit     is_active   enabled
17625012    Active      0

I have 2 million of these but want to update this single row to change enabled to "1" 我有200万个,但想更新这一行以将其更改为“ 1”

I'm struggling - sorry. 我正在努力-对不起。

update unit_status
set enabled = 1
where unit = 17625012    
and is_active = 'Active'
and enabled = 0
limit 1

You can try: 你可以试试:

UPDATE unit_status SET enabled = 1 WHERE unit = 17625012 AND is_active = 'Active' AND enabled = 0

But you should always have a primary key or a unique key. 但是您应该始终具有主键或唯一键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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