开发者

Delete duplicate rows in MySQL Workbench [duplicate]

This question already has answers here: Delete all Duplicate Rows except for One in MySQL? [duplicate] (2 answers) Remove duplicate rows in MySQL 开发者_开发知识库 (26 answers) Closed 15 hours ago.

I'm trying to remove some duplicate values that appear in the Nashville Housing Data for Data Cleaning dataset but my query doesn't work. I am using MySQL Workbench and this is the error I am getting.

Error Code: 1093. You can't specify target table 'Tb1' for update in FROM clause

Can someone explain to me how I can solve it?

DELETE FROM PortafolioProject.NashvilleHousing AS Tb1
WHERE EXISTS (SELECT 1 FROM PortafolioProject.NashvilleHousing AS Tb2
              WHERE Tb2.ParcelID = Tb1.ParcelID AND
                    Tb2.PropertyAddress = Tb1.PropertyAddress AND
                    Tb2.SalePrice = Tb1.SalePrice AND
                    Tb2.SaleDate = Tb1.SaleDate AND
                    Tb2.LegalReference = Tb1.LegalReference AND
                    Tb2.UniqueID < Tb1.UniqueID);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜