3

I have a table with 4 columns like this:

Date           Col1          Col2        Col3

27/03/2012     data          data        data

28/03/2012     data          data        data

I want to delete data from Col1 and Col2 from the row where date is 27/03/2012. Can anybody tell me how the query must be made?

1 Answer 1

10

Is this what you want?

DELETE FROM tableName WHERE Col1="27/03/2012" OR Col2="27/03/2012"

Update in response to some clarifications:

To set Col2 to NULL for a particular date:

UPDATE tableName SET Col2=NULL WHERE Date="27/03/2012"
Sign up to request clarification or add additional context in comments.

5 Comments

Sorry, I didn't ask my question clear. I want to delete the data from col1 and col2 from the row where the column date has the date 27/03/2012, which is in the same row. Hope its clear now what I want.
Just to be clear, you want to find the row where date is 27/03/2012. Do you then want to delete that row, or do you want to set the data in col2 to NULL (or something else)?
Yes, first I want to find the row where date is 27/03/2012. And then I want to set the data in col2 to NULL.
Excellent. Fancy accepting the answer with the big tick too? :-)
I cannot vote up because I don't have enough reputations. I will do this later when I have enough reputations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.