There is a table hf0tv_second , inside the table one column of unique values ​​- second_id - and three columns - second_en_US, second_ru_RU, second_fr_FR .
Also within the table there are four keys (interconnecting other tables) - hf0tv_first_first_id, hf0tv_fourth_fourth_id, hf0tv_countries_countries_id, hf0tv_country_country_id .

How can I remove duplicate lines?

Thank.

Closed due to the fact that off-topic participants PashaPash , Athari , Streletz , Nick Volynkin , Mike Nov. 18 '15 at 14:18 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Athari, Streletz, Mike
If the question can be reformulated according to the rules set out in the certificate , edit it .

    4 answers 4

    select distinct here_column_which_replies, rest_columns ... from hf0tv_second

    And in general, give an example of the request and its result.

    • I am aware that among the unique values ​​I cannot find, I want to make a query other than the second_id table, and delete the second_id lines in vivods, but what do I do with some sort? - lamlam
    • @lamlam, please enable spell checker in your browser. - MrClon

    group by duplicate_field

      DBMS is not at hand, check the syntax of who have the opportunity.

      Trying to understand what you think is repetition.

      Try to give an example.

      My telepaths whispered to me that you count lines with second_id 1 and 3 as a repetition.

       |1|any1|any2|any3| |2|any4|any5|any6| |3|any1|any2|any3| 

      In this case, you can find the lines containing the repetitions as follows:

       select hf0tv_second.* from hf0tv_second left join (select second_en_US,second_ru_RU,second_fr_FR,count(*) from hf0tv_second group by second_en_US,second_ru_RU,second_fr_FR having count(*)>1) as B on hf0tv_second.second_en_US=B.second_en_US and hf0tv_second.second_ru_RU=B.second_ru_RU and hf0tv_second.second_fr_FR=B.second_fr_FR where B.second_en_US is not null 

      Will go?

      • It is necessary to delete duplicate lines: second_en_US second_ru_EN second_fr_FR hf0tv_first_first_id hf0tv_fourth_fourth_id hf0tv_countries_countries_id hf0tv_country_country_id Inside more than half a million lines, hf0tv_country_country_id Inside more than half a million lines, a hf0tv_country_country_id. - lamlam
      • | 1 | any01 | any02 | any03 | any04 | any05 | any06 | any07 | | 2 | any08 | any09 | any10 | any04 | any11 | any11 | any12 | | 3 | any01 | any02 | any03 | any04 | any05 | any06 | any07 | | 4 | any01 | any02 | any03 | any13 | any14 | any15 | any16 | Answer the question what is the repetition: 1) are the repetitions 1 and 3, since do they have all the values ​​in the string, except the key (second_id)? 2) are repetitions 1 and 2, since Do they have the same values ​​hf0tv_first_first_id? 3) Is the coincidence of the values ​​in the row with second_id = 2 hf0tv_fourth_fourth_id and hf0tv_countries_countries_id a repetition? Once again: give an example that you consider repetition! - Rookie_cfg
      • postimg.org/image/qj0xyj0xr remove all similar lines, the photo shows the principles, the problem is that there is a unique second_id line. - lamlam
      • Thanks for the example. Now you can move on. Unique second_id is not a problem. You marked 7 and 8 - I can not understand by what principles they are the same. 15 and 16 also do not look repetitive. - Rookie_cfg September
      • Inside the database there are tables, first, second, etc. For example, in the first table the country is written, then the federal district, then the region, the cities ... hf0tv_second is the lowest level table. second_id is a unique value, the rest is also a name, but with the translation ENG, RUS, FR, and the last columns are the keys of other tables (the tree). - lamlam 2:41 pm

      Need to make a selection without duplicates or remove duplicates from the table? You can use GROUP BY or DISTINCT to select. The first groups the lines (removes duplicates) by one or several columns. DISTINCT , as far as I understand, removes only completely identical strings from the sample (although maybe I misunderstood something).

      • It is necessary to remove duplicates from the table, but there is one column with unique values. Table: hf0tv_second column with unique values: second_id information columns and keys: second_en_US, second_ru_ru, ip_fs_fsfr_fsfr_fsch, ihfc_fsfsh, ipfcfr,, hf0tv_first_fir_id_fy, ihf, ifx, ixf_first_fc_first_fc_first_fc_first_fc_first_fc_first_fc_first_fish_first_fc_first_fish_first_fish_first_fc_first_fc_first_fed_fc_first_fc_first_fy_crypt - lamlam