社区
Delphi
帖子详情
怎样select 出重复的记录后删除,sql how to 写?
gum
2001-08-14 10:25:40
...全文
79
6
打赏
收藏
怎样select 出重复的记录后删除,sql how to 写?
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
tikkypeng
2001-08-16
打赏
举报
回复
Select Distinct 字段 From 表~~就可以了~~
Distinct就是去处相同行~~
lanren
2001-08-16
打赏
举报
回复
建一个临时表,先insert into加dinstict的select 语句先将不重复的记录倒入临时表,清空原表,再倒回来
nne998
2001-08-16
打赏
举报
回复
如果你的目的是整理表(删除重复)的话,可以这样:
while true do
begin
with query1 do
begin
close;
sql.clear;
sql.add('select * from 表名 group by 字段 having count(*)>1');
open;
if recordcount=0 then break;
first;
while not eof do
begin
delete;
next;
end;
end;
end;
ch81
2001-08-14
打赏
举报
回复
dinstict加上去即可。不同的才出现。
tob
2001-08-14
打赏
举报
回复
用distinct就可以了。
xiaoxinxx168
2001-08-14
打赏
举报
回复
为什么要查出后再删除?为什么不用select distinct(ZGBH) from table来去掉重复的记录?
(ZGBH为表中的一个字段。)
《深入浅
出
SQL
》(Head First
SQL
)[PDF].part1
2008年Jolt大奖得主,经典的Head First系列,相信曾经读过Head First Design Pattern的朋友都深有感触。有别于传统的计算机类教科书,Head First系列中图画多,文字少,知识都贯穿在一个情境里面,读起来非常轻松。要学习
SQL
的朋友,这本书不容错过哦! 2008 Jolt Productivity Award Winner! Is your data dragging you down? Are your tables all tangled up? Well we've got the tools to teach you just how to wrangle your databases into submission. Using the latest research in neurobiology, cognitive science, and learning theory to craft a multi-sensory
SQL
learning experience, Head First
SQL
has a visually rich format designed for the way your brain works, not a text-heavy approach that puts you to sleep. Maybe you've written some simple
SQL
queries to interact with databases. But now you want more, you want to really dig into those databases and work with your data. Head First
SQL
will show you the fundamentals of
SQL
and how to really take advantage of it. We'll take you on a journey through the language, from basic INSERT statements and
SELECT
queries to hardcore database manipulation with indices, joins, and transactions. We all know "Data is Power"—but we'll show you how to have "Power over your Data". Expect to have fun, expect to learn, and expect to be querying, normalizing, and joining your data like a pro by the time you're finished reading!
《深入浅
出
SQL
》(Head First
SQL
)[PDF].part2
2008年Jolt大奖得主,经典的Head First系列,相信曾经读过Head First Design Pattern的朋友都深有感触。有别于传统的计算机类教科书,Head First系列中图画多,文字少,知识都贯穿在一个情境里面,读起来非常轻松。要学习
SQL
的朋友,这本书不容错过哦! 2008 Jolt Productivity Award Winner! Is your data dragging you down? Are your tables all tangled up? Well we've got the tools to teach you just how to wrangle your databases into submission. Using the latest research in neurobiology, cognitive science, and learning theory to craft a multi-sensory
SQL
learning experience, Head First
SQL
has a visually rich format designed for the way your brain works, not a text-heavy approach that puts you to sleep. Maybe you've written some simple
SQL
queries to interact with databases. But now you want more, you want to really dig into those databases and work with your data. Head First
SQL
will show you the fundamentals of
SQL
and how to really take advantage of it. We'll take you on a journey through the language, from basic INSERT statements and
SELECT
queries to hardcore database manipulation with indices, joins, and transactions. We all know "Data is Power"—but we'll show you how to have "Power over your Data". Expect to have fun, expect to learn, and expect to be querying, normalizing, and joining your data like a pro by the time you're finished reading!
Introducing
SQL
Server(Apress,2015)
Introducing
SQL
Server is a fast and easy introduction to
SQL
Server and the world of relational databases. You'll learn how databases work and how to use the T-
SQL
language by practicing on one of the most widely-used and powerful database engines in the corporate world: Microsoft
SQL
Server. Do you quake at the sight of a
SELECT
statement? Start to shiver when people start talking about tables and rows? Fear not, Introducing
SQL
Server is here to rescue you. The book focuses on the knowledge and skills needed to begin your journey toward becoming a solid and competent
SQL
Server professional and database programmer. You'll learn the core concepts of
SQL
Server, from installing the software to executing and profiling queries.
SQL
Server 2014 Development Essentials - Masood-Al-Farooq, Basit A. [SRG].pdf
What this book covers Chapter 1, Microsoft
SQL
Server Database Design Principles, explains the database design process and the architecture and working of the
SQL
Server 2014 Storage Engine. This chapter covers the database development life cycle in detail, including the normalization and denormalization process, beneits of choosing appropriate data types, and the functioning of the
SQL
Server 2014 Storage Engine. Chapter 2, Understanding DDL and DCL Statements in
SQL
Server, introduces the reader to the
SQL
Server 2014 Transact-
SQL
language elements and
SQL
Server 2014 Management Studio (SSMS 2014). This chapter explains Transact-
SQL
DDL, DCL, and DML language elements in detail, and how you can use them to create, manage, and secure
SQL
Server 2014 databases, schemas, and tables. This chapter also shows you how you can use
SQL
Server Management Studio to create and manage
SQL
Server 2014 databases, schemas, and tables. Finally, this chapter covers the purpose of
SQL
Server 2014 system databases and highlights the advantages and disadvantages of database recovery models. Chapter 3, Data Retrieval Using Transact-
SQL
Statements, demonstrates how to query data from tables, how to write multiple table queries, and how to group, organize, and pivot result set data. This chapter explores the basic form of the
SELECT
statement and how it can be used to query data from tables. This chapter also highlights the different categories of built-in T-
SQL
functions and how you can use them in your
SELECT
statements. This chapter also explains different techniques that you can use to combine data from multiple tables, how to organize the data, and how to generate the summary data by grouping or pivoting it. Finally, this chapter covers the purpose of the CTE and
SQL
Server 2014 windowing functions and how to use them to quickly solve complex analytical tasks. Chapter 4, Data Modiication with
SQL
Server Transact-
SQL
Statements, illustrates how to add, modify, and delete data in tables using Transact-
SQL
DML statements. This chapter covers how to add data to a table using the INSERT statement, how to delete the data using the DELETE statement, and how to update existing data using the UPDATE statement. This chapter also covers the
SELECT
…INTO, MERGE, and TRUNCATE TABLE statements, and it highlights the key new enhancements of these statements in
SQL
Server 2014. Chapter 5, Understanding Advanced Database Programming Objects and Error Handling, covers reusable programming objects that includes views, stored procedures (normal and natively compiled), functions and triggers (based on either DDL or DML),
SQL
Server 2014 control-of-low statements, and structured error handling blocks. This chapter shows you how you can declare and use variables and how you can use control-of-low statements to control your program execution. Next, it explains the purpose of views, stored procedures, user-deined functions, and triggers, and highlights the guidelines and restrictions to design each of these programmable objects. This chapter also illustrates how to handle errors that occur within Transact-
SQL
batches and programmable objects using the TRY...CATCH construct. Chapter 6, Performance Basics, explains performance-related features of
SQL
Server 2014. This chapter irst explains the architecture of the
SQL
Server Relational Engine. Then, it introduces the architecture of the
SQL
Server 2014 in-memory technology. Next, it covers all
SQL
Server 2014 index types and how they can be used to achieve optimal query performance while reducing the overall response time. Then, it explores the architectural differences of B-tree, Bw-tree, and xVelocity columnstore indexes. Finally, it explains core performance topics such as
SQL
Server query optimization statistics,
SQL
Server transactions and locks, and tools that come with
SQL
Server 2014 Database Engine, which you can use to monitor and troubleshoot its Database Engine performance.
Delphi
5,927
社区成员
262,932
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章