mysql - SELECT unique values from table with multiple columns containing similar data -
I am trying to select a list of country codes from the country that contains 3 different There are columns.
Example
Raw desired + ----------- + ---------- - + ----------- + + ----------- + | Country_1 | Country_2 | Country_3 | | Countries | + ----------- + ----------- + ----------- + ----------- + | GBR | GBR | IRL | | ARG | | DEU | FRA | CHE | | Australia | | CHN | CHN | Ind | | BRA | | United States Can do it. MX | | Can do it. | Australia | JAP | Core | | CHE | | BRA | ARG | ARG | | CHN | | Knorr | SWE | Finn | | DEU | | GBR | FRA | GBR | | Finn | | IRL | IRL | IRL | | FRA | + ----------- + ----------- + ----------- + | GBR | | Ind | | IRL | | JAP | | Core | | MX | | Knorr | | SWE | | United States + ----------- +
The one closest to me so far is such a query:
mysql & Gt; Choose Conset (from Tbl), ',', (Countries from country to country country according to Blogger), ',', (Select country country ORDER country country), ',' TBL)); + ------------------------------------------------- ------------------------------------------------ + | Countries | + ------------------------------------------------- ------------------------------------------------ + | AUS, BRA, CNN, DUU, GBR, IRL, NOR, USA, ARG, Can, CAN, FRA, GBR, IRL, JAP, SWE, ARG, CA, FIN, GBR, IND, IRL, Core, MEX. + ------------------------------------------------- ------------------------------------------------ + < / Code>
But as you can see, there are still duplicates and I'm not sure how I can get them into lines.
Any help is appreciated!
I am not sure why you want to use the group consulate, with the desired results easily with the union Can be completed, which automatically removes duplicates.
Comments
Post a Comment