Jump to content

more repeated data in a column


tuzojazz

Recommended Posts

Hi:suposse I have this table named "Employees" Employees-----------------------Emloyee----Country-------------------------Geroge-------GermanyJohn-----------ItalySteve----------MexicoJim-------------GermanyBrian-----------GermanyRichard---------ItalyI want to get the countries in order that are repeated like thisGermanyItalyMexicohow can I do this query?Thanks!!

Link to comment
Share on other sites

You mean likeGeroge-------GermanyJohn-----------ItalySteve----------MexicoJim-------------GermanyRichard---------ItalyBrian-----------GermanyorGeroge-------GermanyBrian-----------GermanyJim-------------GermanyJohn-----------ItalyRichard---------ItalySteve----------MexicoThere is no way to perform the former that I can think of, but the latter can be done through ORDER BY

SELECT Employee, Country FROM Employees ORDER BY Country

Link to comment
Share on other sites

If you just want to get the list of countries you can do this:
SELECT DISTINCT Country FROM Employees

I want to get the countries in order where are the most of the employeesanother exampleGeroge-------MexicoJohn-----------ItalySteve----------MexicoJim-------------MexicoRichard---------ItalyBrian-----------GermanyI want to get this orderMexicoItalyGermany
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...