MySQL DISTINCT, mysqldistinct
DISTINCT (COL) is used to remove duplicates from results.
For example, the table content is as follows:
Select distinct (id) FROM yww_test
The following example shows how to select data that has not appeared in the past day.
-- Collect the original offline data and prepare to merge the data with other tables. drop view if EXISTS 'unconnected_elemeterhead'; create view unconnected_elemeterheadASSELECTDATE_SUB (curdate (), INTERVAL 1 DAY) as 'uhead _ date', head. 'name' as 'uhead _ name', head. PADDRESS as head_address, head. e_BUREAU_ID as bureau_id, head. ID as 'uhead _ id' FROMe _ elemeterhead_link39 AS headWHEREhead. 'status' = 0AND head. id not in (select distinct (. e_ELEMETERHEAD_ID) FROMe_eledata AS aWHEREto_days (now ()-to_days (. DLDT) = 1 );
Note: How to Determine yesterday and how to count the undisplayed IDS