社区
Delphi
帖子详情
怎样select 出重复的记录后删除,sql how to 写?
gum
2001-08-14 10:25:40
...全文
74
6
打赏
收藏
怎样select 出重复的记录后删除,sql how to 写?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用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].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!
Getting.Started.with.
SQL
.A.Hands-On.Approach.for.Beginners
Businesses are gathering data today at exponential rates and yet few people know how to access it meaningfully. If you’re a business or IT professional, this short hands-on guide teaches you how to pull and transform data with
SQL
in significant ways. You will quickly master the fundamentals of
SQL
and learn how to create your own databases. Author Thomas Nield provides exercises throughout the book to help you practice your newfound
SQL
skills at home, without having to use a database server environment. Not only will you learn how to use key
SQL
statements to find and manipulate your data, but you’ll also discover how to efficiently design and manage databases to meet your needs. You’ll also learn how to: Explore relational databases, including lightweight and centralized models Use
SQL
ite and
SQL
iteStudio to create lightweight databases in minutes Query and transform data in meaningful ways by using
SELECT
, WHERE, GROUP BY, and ORDER BY Join tables to get a more complete view of your business data Build your own tables and centralized databases by using normalized design principles Manage data by learning how to INSERT, DELETE, and UPDATE records Table of Contents Chapter 1. Why Learn
SQL
? Chapter 2. Databases Chapter 3.
SQL
ite Chapter 4.
SELECT
Chapter 5. WHERE Chapter 6. GROUP BY and ORDER BY Chapter 7. CASE Statements Chapter 8. JOIN Chapter 9. Database Design Chapter 10. Managing Data Chapter 11. Going Forward Appendix A. Operators and Functions Appendix B. Supplementary Topics
SQL
Server数据库基础到精通课程
本课程是陈表达在学习
SQL
server数据库后做的完整笔记,本课程讲解从最开始的 创建数据库、创建数据表、已经数据的
写
入、查询、修改更新、
删除
,字段运算、字段运算统计、分类汇总、数据分析、条件判断,条件筛选及一些常用的
SQL
数据库语句,变量定义,字段约束、等等,
Select
、Where、Top、Group By 、Order By,Distinct、Declare等,详细可看图片和课程,本课程带有完整的
SQL
数据库课程课件,代码有注释解析等等,学习起来简单易懂,易上手直接操作,需要做数据分析,数据统计等工作的朋友们就赶紧学起来了,加油!
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,379
社区成员
262,722
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章