PostgreSQL 查询表中重复数据

前端之家收集整理的这篇文章主要介绍了PostgreSQL 查询表中重复数据前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1)查询表中重复数据

SELECT * FROM "tbScenics"
WHERE "Scenic_Id"
NOT IN (
SELECT max("Scenic_Id")
FROM "tbScenics"
GROUP BY "Scenic_Name","Scenic_Des","Scenic_Price","Scenic_Ticket"

);

2)删除表中重复数据 DELETE * FROM "tbScenics" WHERE "Scenic_Id" NOT IN ( SELECT max("Scenic_Id") FROM "tbScenics" GROUP BY "Scenic_Name","Scenic_Ticket" );

猜你在找的Postgre SQL相关文章