

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Fix ERROR 1093 (HY000): You can't specify target table for update in FROM clause while deleting the lowest value from a MySQL column?
Let us first create a table −
mysql> create table DemoTable1597 -> ( -> Marks int -> ); Query OK, 0 rows affected (0.69 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1597 values(45); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable1597 values(59); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable1597 values(43); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1597 values(85); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable1597 values(89); Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1597;
This will produce the following output −
+-------+ | Marks | +-------+ | 45 | | 59 | | 43 | | 85 | | 89 | +-------+ 5 rows in set (0.00 sec)
Here is the query to remove ERROR 1093 (HY000). We are deleting the lowest value here −
mysql> delete from DemoTable1597 -> where Marks=( -> select lowestMarks from ( select min(Marks) as lowestMarks from DemoTable1597 ) as deleteRecord -> ) limit 1; Query OK, 1 row affected (0.11 sec)
Let us check the table records once again −
mysql> select * from DemoTable1597;
This will produce the following output −
+-------+ | Marks | +-------+ | 45 | | 59 | | 85 | | 89 | +-------+ 4 rows in set (0.00 sec)
- Related Questions & Answers
- MySQL Error ERROR 1099 (HY000): Table was locked with a READ lock and can't be updated
- Fix Error in MySQL syntax while creating a table column with name “index”?
- Fix: ERROR 1396 (HY000): Operation CREATE USER failed in MySQL?
- How to fix the incorrect datetime value while inserting in a MySQL table?
- Fix for MySQL ERROR 1406: Data too long for column” but it shouldn't be?
- Fix ERROR 1064 (42000) while creating a database in MySQL?
- How can we extract a substring from the value of a column in MySQL table?
- Fix Error 1136: Column count doesn't match value count at row 1?
- How can I use MySQL subquery as a table in FROM clause?
- How can we update MySQL table after removing a particular string from the values of column?
- How can we remove a column from MySQL table?
- Reorder keys after deleting a record from MySQL table?
- How can I update a field in a MySQL database table by adding a value in the second table with a value from the first table?
- Fix Drop table view #1051 unknown table error in MySQL
- Update only a single value from a MySQL table where select from same table ordered in descending order?
Advertisements