
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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 Articles
- Fix Error in MySQL syntax while creating a table column with name “index”?
- MySQL Error ERROR 1099 (HY000): Table was locked with a READ lock and can't be updated
- Fix: ERROR 1396 (HY000): Operation CREATE USER failed in MySQL?
- Fix for MySQL ERROR 1406: Data too long for column” but it shouldn't be?
- How to fix the incorrect datetime value while inserting in a MySQL table?
- Fix ERROR 1064 (42000) while creating a database in MySQL?
- How can we update MySQL table after removing a particular string from the values of column?
- Fix Error 1136: Column count doesn't match value count at row 1?
- How can we extract a substring from the value of a column in MySQL table?
- How can I use MySQL subquery as a table in FROM clause?
- Fix error in MySQL “select ClientId,ClientName,ClientAge, from tablename”
- 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?
- How can we remove a column from MySQL table?

Advertisements