检查 2 个字段,如果一个字段有部分号码更改其他
check 2 fields if one has part of number change other
我在名为 tbl_data
的 table 下有 2 列
cat_id 和 ip_url
如果 ip_url 有像 http://0.00.00.00 这样的数字,则需要一个订单来检查所有字段
然后把cat_id改成某个值
我只想更改以 http://0.00 开头的字段,因为最后 4 位数字在所有字段中都不相同
我该怎么做?
您可以使用 LIKE
来实现。
例如:
UPDATE tbl_data SET cat_id = 'something'
WHERE ip_url LIKE 'http://0.00.%'
^ anything after
更多关于LIKE的用法,请访问以下link:
我在名为 tbl_data
的 table 下有 2 列cat_id 和 ip_url
如果 ip_url 有像 http://0.00.00.00 这样的数字,则需要一个订单来检查所有字段 然后把cat_id改成某个值
我只想更改以 http://0.00 开头的字段,因为最后 4 位数字在所有字段中都不相同 我该怎么做?
您可以使用 LIKE
来实现。
例如:
UPDATE tbl_data SET cat_id = 'something'
WHERE ip_url LIKE 'http://0.00.%'
^ anything after
更多关于LIKE的用法,请访问以下link: