0

If I have a table with only one column, how could I delete a particular row from it? I know the most logical answer would be to have another column in the table with a number that automatically increments, but in a table with only one column, how would I go about doing this? Is there something I can add in the WHERE clause to say row = 3 or something similar?

Brit24
  • 65
  • 8

2 Answers2

0

You can do:

delete t from t
   where col = @value;

However, that will delete all rows with the value. If the value is unique, you should declare the column to be either unique or a primary key.

I should add that you can delete just one row with the value by adding limit 1:

delete t from t
   where col = @value
   limit 1;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
0

Please try the following...

DELETE FROM tblTable
WHERE fieldName = targetValue;

If you have any questions or comments, then please feel free to post a Comment accordingly.

toonice
  • 2,211
  • 1
  • 13
  • 20