Really basic mySQL Query - replace values
This must be really simple:
On mySQL -
UPDATE exp_channel_data
Where entry_id is between 10169 and 10860
If custom_field is value 18
REPLACE with 17
Any ideas? I'm really struggling with the little knowledge I have开发者_高级运维!
UPDATE exp_channel_data
SET custom_field = 17
WHERE custom_field = 18
AND entry_id BETWEEN 10169 AND 10860
I actually don't remember for sure whether BETWEEN is supported; if not:
UPDATE exp_channel_data
SET custom_field = 17
WHERE custom_field = 18
AND entry_id >= 10169
AND entry_id <= 10860
UPDATE exp_channel_data
SET custom_field = 17
WHERE custom_field = 18 AND entry_id > 10169 AND entry_id < 10860
If you want to include 10169 and 10860 use a BETWEEN statement.
The BETWEEN operator functions as 'greater than or equal to' [NUMBER] AND 'less than or equal to' [NUMBER].
BETWEEN example:
UPDATE exp_channel_data
SET custom_field = 17
WHERE custom_field = 18 AND entry_id BETWEEN 10169 AND 10860
精彩评论