Oracle-, a table increases the number of calculations a value of a column duplicate column, and other columns in the table is also displayed, or do some treatment in the filtering process shown

to sum up:

1, a column calculated value (numeric or string) number of repetitions

select 列1,count( 列1 or *) count1  from table1 group by 列1

Output from the table: The first column is a column retention unique value, the second column is a column count1 tables.

Q: Then how do the other columns also display information out of it? Can refer to: http://www.myexception.cn/oracle-develop/1767413.html   I'm here to make myself a summary of the next step.
2, a table adds a number of calculations a column value duplicate column, and the table of other columns are also displayed, or to do some filtering of the process shown in the process
(1) If the column 1 with the remaining columns of Offers are one to one, that directly or min () function to get them to deal with the remaining columns show the rest of the column can be completely information max ().

   select count (column 1 or *) count1, max (Column 2) Column 2, max column (column 3) 3, max (column 4) Column 4 from table1 group by columns 1

 (2) If, among the rest of the column 1 with column information are many, that max () or min () will realize that retain the maximum or minimum (these two functions: can process values, sooner or later, date size, strings can be processed output is not given)

3, if the column is between one to many, but also how to achieve "not only to achieve statistical calculation functions, and complete the remaining columns display the information it?"

select SS.*,TT.*  from table1 SS  left join (select 列1,count( 列1 or *) count1  from table1 group by 列1) TT on SS.列1=TT.列1

4, again at max () or min () function is a function of the good

(1) a strong filtering: filtering column according to the order of relevance to achieve filtering, a funnel-like layers of filtration

(2) may also be used in conjunction with other functions, e.g., concat (), substr ()

 

Paste at the example:

1, group by retention TEL_DLR achieve unique value, max () min () implement filtering

Guess you like

Origin www.cnblogs.com/Formulate0303/p/12033876.html