Welcome to the Linux community forum, and interact with 2 million technical staff to enter the GROUPBY statement to implement deduplication query for a certain column. Directly run the preceding statement: selectio_dev_idfromio_infowhere (Tyang1) GROUPBY1; deduplication by io_dev_id. P: add it with ORDERBY and disti.
Welcome to the Linux community forum and interact with 2 million technical staff> enter the group by statement to implement deduplication query for a certain 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: Add order by and disti.
Welcome to the Linux community forum and interact with 2 million technicians>
The group by statement can deduplicate a column.
Directly run the following statement:
Select io_dev_id from io_info where (TID = 1 AND host_name = 'ang1') group by 1;
Deduplicate query by io_dev_id.
P: Use order by and distinct.
Group by is selected based on columns
Order by is sort BY Column
Distinct is similar to group by, but can only be placed behind select, before the filtered field.
For example, select distinct a, B, c from tb1;
Select data with the same values in column a, column B, and column c.
Extracted content from mysql 5.6 reference manual:
In most cases, a DISTINCT clause can be considered as a special case of group by. For example, the following two queries are equivalent:
Select distinct c1, c2, c3 FROM t1
WHERE c1> const;
SELECT c1, c2, c3 FROM t1
WHERE c1> const group by c1, c2, c3;