/***********************************************Duplicate records in two meanings:1. is a completely duplicate record, that is, all fields are duplicates of the record,2. is a duplicate record of some key fields, such as username field
Thanks to Sun Yunan's summary, address http://www.cnblogs.com/sunxiaonan/archive/2009/11/24/1609439.htmlFor example:ID Name Value1 a pp2 a PP3 B III4 B pp5 B pp6 C pp7 C pp8 C IIIID is primary keyAsk for such a resultID Name Value1 a pp3 B III4 B pp6
For example:ID Name Value1 a pp2 a PP3 B III4 B pp5 B pp6 C pp7 C pp8 C IIIID is primary keyAsk for such a resultID Name Value1 a pp3 B III4 B pp6 C pp8 C IIIMethod 1Delete yourtablewhere [id] not in (Select MAX ([id]) from yourtableGroup BY (name +
There are two ways to use it:1. Single Statement method:1) Delete b from Sys_test B, (select *,max (UUID) from Sys_test Group BY ' name ' have count (' name ') > 1) as D where B.uu Id>d.uuid and b.name = D.nameDelete b from Sys_test B is a set alias,
MySQL grouping and aggregation functionsThere are 5 Mysql aggregation functions:1, COUNT () number of records (count (1), COUNT (*) Table rows, count (column name) statistics column non-null number)2, max () maximum value3, min () minimum value4,
Oracle self-contained function wm_concat sorting when wm_concat connects strings, sometimes it is not sorted according to your requirements. For example, a table test has a field id, name, product
Oracle self-contained function wm_concat sorting
For example:Id name value1 a pp2 a pp3 B iii4 B pp5 B pp6 c pp7 c pp8 c iiiId is the primary keyThis result is required.Id name value1 a pp3 B iii4 B pp6 c pp8 c iiiMethod 1Delete YourTableWhere [id] not in (Select max ([id]) from YourTableGroup by (
How does mysql Delete duplicate record statements ?? For example, idnamevalue1app2app3biii4bpp5bpp6cpp7cpp8ciiiid is the primary key required to obtain this result idnamevalue1app3biii4bpp6cpp8ciii method 1 deleteYourTable
How does mysql Delete
Introduction: this is not a deep technical question, but a cool programming capability. This is not directly related to a person's development capabilities, but knowing this will be of great help to your SQL writing, troubleshooting and optimization.
1. Use the select statement to query the select * from data table name of a data table. 2. query the select Field 1 and 2from data table of one or more fields in the table; 3. query the specified data in the table. select * from the data table name
(1) Table Name: shopping information
Number of commodity names of the shopper
A A 2
B 4
C 1
A Ding 2
B C 5
......
(
Others You can insert user lab records on your own)
Records of buyers of two or more purchased items
Answer: Select * from
For example:Id name value1 a pp2 a pp3 B iii4 B pp5 B pp6 c pp7 c pp8 c iiiId is the primary keyThis result is required.Id name value1 a pp3 B iii4 B pp6 c pp8 c iii
Method 1Copy codeThe Code is as follows:Delete YourTableWhere [id] not in (Select
For example:Id name value1 a pp2 a pp3 B iii4 B pp5 B pp6 c pp7 c pp8 c iiiId is the primary keyThis result is required.Id name value1 a pp3 B iii4 B pp6 c pp8 c iiiMethod 1Delete YourTableWhere [id] not in (Select max ([id]) from YourTableGroup by (
Original post address: http://www.cnblogs.com/phpliu/archive/2010/06/21/1761726.html
For example:ID name value1 A PP2 A PP3 B III4 B PP5 B PP6 c pp7 c pp8 C IIIID is the primary keyThis result is required.ID name value1 A PP3 B III4 B PP6 c pp8 C
For example:ID name value1 A PP2 A PP3 B III4 B PP5 B PP6 c pp7 c pp8 C IIIID is the primary keyThis result is required.ID name value1 A PP3 B III4 B PP6 c pp8 C III
Method 1Delete yourtableWhere [ID] Not in (Select max ([ID]) from yourtableGroup by
(1) Table Name: shopping informationNumber of commodity names of the shopperA A 2B 4C 1A Ding 2B C 5......(You can insert records of other user experiments)
Records of buyers of two or more purchased items
Answer: Select * from shopping information
Convert multiple columns into one row, and convert multiple columns into one row.
A friend asked me how to convert multiple columns into one row in Impala. In fact, the built-in functions in Impala can be implemented without using custom
-- Row and column conversion of classic SQL statements
-- Http://www.programbbs.com/doc/4885.htm/##:normal row-column conversion (Version 2.0) Description: normal row-column conversion (version 1.0) only provides static and dynamic writing for SQL
– The structure of the table ' test '–CREATE TABLE IF not EXISTS ' test ' (' id ' int (one) not NULL auto_increment,' Name ' varchar (+) is not NULL,' Phone ' int (one) is not NULL,PRIMARY KEY (' id ')) Engine=myisam DEFAULT Charset=utf8;–– Export
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service