sql UNION过滤重复记录语句并取得不重复的数据
//我们一般是用union all 改成union看一下,联合查询显示不重复的记录哦。
sql UNION过滤重复记录语句并取得不重复的数据
$sql ="UNION ALL->UNION
--------------------
--以下句子如何取得不重复的数据?
SELECT DISTINCT TOP 100 PERCENT kirinLDS.dbo.tbl人员调整.部门名 AS 部门名
FROM kirinLDS.dbo.tbl人员 INNER JOIN
kirinLDS.dbo.tbl定单 ON kirinLDS.dbo.tbl人员.工号 = kirinLDS.dbo.tbl定单.业务员 INNER JOIN
kirinLDS.dbo.tbl人员调整 ON kirinLDS.dbo.tbl人员.姓名 = kirinLDS.dbo.tbl人员调整.人员
WHERE (LEFT(kirinLDS.dbo.tbl定单.会计月, 4) = '2009')
UNION
SELECT DISTINCT TOP 100 PERCENT kirinSZ.dbo.tbl人员调整.部门名 AS 部门名
FROM kirinSZ.dbo.tbl人员 INNER JOIN
kirinSZ.dbo.tbl定单 ON kirinSZ.dbo.tbl人员.工号 = kirinSZ.dbo.tbl定单.业务员 INNER JOIN
kirinSZ.dbo.tbl人员调整 ON kirinSZ.dbo.tbl人员.姓名 = kirinSZ.dbo.tbl人员调整.人员
WHERE (LEFT(kirinSZ.dbo.tbl定单.会计月, 4) = '2009')
UNION
SELECT DISTINCT TOP 100 PERCENT kirinLDSbj.dbo.tbl人员调整.部门名 AS 部门名
FROM kirinLDSbj.dbo.tbl人员 INNER JOIN
kirinLDSbj.dbo.tbl定单 ON kirinLDSbj.dbo.tbl人员.工号 = kirinLDSbj.dbo.tbl定单.业务员 INNER JOIN
kirinLDSbj.dbo.tbl人员调整 ON kirinLDSbj.dbo.tbl人员.姓名 = kirinLDSbj.dbo.tbl人员调整.人员
WHERE (LEFT(kirinLDSbj.dbo.tbl定单.会计月, 4) = '2009')
";
//我们一般是用union all 改成union看一下,联合查询显示不重复的记录哦。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

Pinduoduo software provides a lot of good products, you can buy them anytime and anywhere, and the quality of each product is strictly controlled, every product is genuine, and there are many preferential shopping discounts, allowing everyone to shop online Simply can not stop. Enter your mobile phone number to log in online, add multiple delivery addresses and contact information online, and check the latest logistics trends at any time. Product sections of different categories are open, search and swipe up and down to purchase and place orders, and experience convenience without leaving home. With the online shopping service, you can also view all purchase records, including the goods you have purchased, and receive dozens of shopping red envelopes and coupons for free. Now the editor has provided Pinduoduo users with a detailed online way to view purchased product records. method. 1. Open your phone and click on the Pinduoduo icon.

"Usage of Division Operation in OracleSQL" In OracleSQL, division operation is one of the common mathematical operations. During data query and processing, division operations can help us calculate the ratio between fields or derive the logical relationship between specific values. This article will introduce the usage of division operation in OracleSQL and provide specific code examples. 1. Two ways of division operations in OracleSQL In OracleSQL, division operations can be performed in two different ways.

Oracle and DB2 are two commonly used relational database management systems, each of which has its own unique SQL syntax and characteristics. This article will compare and differ between the SQL syntax of Oracle and DB2, and provide specific code examples. Database connection In Oracle, use the following statement to connect to the database: CONNECTusername/password@database. In DB2, the statement to connect to the database is as follows: CONNECTTOdataba

Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

What is Identity in SQL? Specific code examples are needed. In SQL, Identity is a special data type used to generate auto-incrementing numbers. It is often used to uniquely identify each row of data in a table. The Identity column is often used in conjunction with the primary key column to ensure that each record has a unique identifier. This article will detail how to use Identity and some practical code examples. The basic way to use Identity is to use Identit when creating a table.

When using Quark Browser, there is a function to filter duplicate files. Some friends are not very familiar with this. Here I will introduce how to turn on this function. If you are interested, come and take a look with me. 1. First, click "Quark Browser" on your mobile phone to enter the interface, then click and select "Quark Network Disk" in the options in the middle of the page to open and enter. 2. Find "Backup Settings" in the lower part of the Quark network disk interface, and click to open it, as shown in the figure below: 3. Next, on the page you enter, there is a "Filter Duplicate Files", which is displayed behind it There is a switch button. Click the circular slider on it and set it to color to turn on this function. When you continue to back up files, duplicate files will be skipped to save network disk capacity.

Solution: 1. Check whether the logged-in user has sufficient permissions to access or operate the database, and ensure that the user has the correct permissions; 2. Check whether the account of the SQL Server service has permission to access the specified file or folder, and ensure that the account Have sufficient permissions to read and write the file or folder; 3. Check whether the specified database file has been opened or locked by other processes, try to close or release the file, and rerun the query; 4. Try as administrator Run Management Studio as etc.
