This is my from three selected data in the table, including the data in the red box and the green box, repeat, how to select the data to heavy, leaving only a data? I just learn MYSQL, a great god show
CodePudding user response:
Duplicate data function row_number please understand, as here, only take a share - essentially a method
CodePudding user response:
You can directly use the distinct keyword!
CodePudding user response:
Distinct can only choose a field? I'm going to pick three fields of the same data
CodePudding user response:
The
reference 3 floor qq_41947073 response: distinct can only choose a field? I'm going to pick three fields of the same data Distinct behind you can talk with three fields, but not show the three fields of other fields, CodePudding user response:
Using distinct behind with fields can be heavy, you should be go to the heavy all the same, with distinct directly CodePudding user response:
So ah, I use the group by, the grouping of data according to the three fields, can now display a single data, but the question now is how to create a new table in navicat again, the data stored in the new table I pick? The following is a group by group as a result, after The SELECT com_el. Adm, com_el ntc_id, com_el. Sat_name, com_el. Ntc_type, GRP. Grp_id, GRP. D_rcv, GRP. Freq_min, GRP. Freq_max, pub_ssn. Ssn_ref, pub_ssn. Ssn_no The FROM pub_ssn INNER JOIN (com_el INNER JOIN GRP ON com_el. Ntc_id=GRP. Ntc_id) ON pub_ssn. Ntc_id=GRP. Ntc_id WHERE Com_el adm! AND ='CHN'(com_el ntc_type='N' AND ((((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & gt;=7235) AND ((GRP) freq_max) & lt;=7243)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt;=7235) AND ((GRP) freq_max) & gt; 7235)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt; 7243) AND ((GRP) freq_max) & gt;=7243)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & gt;=8025) AND ((GRP) freq_max) & lt;=8050)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt;=8025) AND ((GRP) freq_max) & gt; 8025)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt; 8050) AND ((GRP) freq_max) & gt;=8050)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & gt;=27500) AND ((GRP) freq_max) & lt;=30000)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt;=27500) AND ((GRP) freq_max) & gt;=27500)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt; 30000) AND ((GRP) freq_max) & gt;=30000)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & gt;=17700) AND ((GRP) freq_max) & lt;=20200)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt;=17700) AND ((GRP) freq_max) & gt; 17700)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt; 20200) AND ((GRP) freq_max) & gt;=20200)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & gt;=37500) AND ((GRP) freq_max) & lt;=42500)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt;=37500) AND ((GRP) freq_max) & gt; 37500)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt; 42500) AND ((GRP) freq_max) & gt;=42500)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & gt;=47200) AND ((GRP) freq_max) & lt;=51400)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt;=47200) AND ((GRP) freq_max) & gt; 47200)) AND ((pub_ssn ssn_ref)="API/A") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt; 51400) AND ((GRP) freq_max) & gt;=51400)) AND ((pub_ssn ssn_ref)="API/A"))) OR (com_el ntc_type='G' AND ((((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt;=28600) AND ((GRP) freq_max) & gt; 28600)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt; 29500) AND ((GRP) freq_max) & gt;=29500)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & gt;=28600) AND ((GRP) freq_max) & lt;=29500)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt;=18800) AND ((GRP) freq_max) & gt; 18800)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & lt; 19700) AND ((GRP) freq_max) & gt;=19700)) AND ((pub_ssn ssn_ref)="CR/C") OR (((GRP) d_rcv) & gt; '20181228') AND ((GRP) freq_min) & gt;=18800) AND ((GRP) freq_max) & lt;=19700)) AND ((pub_ssn ssn_ref)="CR/C"))) GROUP BY com_el. Adm, com_el ntc_id, com_el. Sat_name, GRP. Freq_min, GRP. Freq_max CodePudding user response:
@ half a bottle of water will also want to fill the According to what you said with a distinct, but still have a lot of repetitive data CodePudding user response:
Distinct is absolutely impossible to duplicate, after you must have distinct and other operations CodePudding user response:
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull