Mysql deduplication query bitsCN.com
The group by statement can deduplicate a column.
Directly run the preceding statement: select io_dev_id from io_info where (TID = 1 AND host_name = 'yang1') group by 1; deduplication BY io_dev_id. P: the difference between order by and distinct is that group by is used to select order by based on the column. distinct is similar to group by, but it can only be placed behind select, the front of the filtered field. For example, select distinct a, B, c from tb1; select data with the same values in column a, B, and c. Extracted mysql 5.6 reference manual: In most cases, a DISTINCT clause can be considered as a special case of group. for example, the following two queries are equivalent: select distinct c1, c2, c3 FROM t1WHERE c1> const; SELECT c1, c2, c3 FROM t1WHERE c1> const group by c1, c2, c3; bitsCN.com