Jump to content

more repeated data in a column


tuzojazz
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...