开发者

Delete specific values from column with where condition?

I want to delete specific values/data from one column with the WHERE condition. Putting 开发者_如何学Pythonin another way, I don't want to delete the complete row. Is it possible?


UPDATE YourTable SET columnName = null WHERE YourCondition


UPDATE myTable 
   SET myColumn = NULL 
 WHERE myCondition


You don't want to delete if you're wanting to leave the row itself intact. You want to update the row, and change the column value.

The general form for this would be an UPDATE statement:

UPDATE <table name>
SET
    ColumnA = <NULL, or '', or whatever else is suitable for the new value for the column>
WHERE
    ColumnA = <bad value> /* or any other search conditions */


You can also use REPLACE():

UPDATE Table
   SET Column = REPLACE(Column, 'Test123', 'Test')


Try this SQL statement:

update Table set Column =( Column - your val )
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜