Dear all:
I am newbie to SQL and I encountered a 'difficult' problem in development.Right now I have table that records all the SMS sent out by the customers. The table fields are defined as bellow:
indexID int(11) //primary key (auto increment)
sender varchar(50) //sender's nick name
datetime datetime //the time when sender sends out sms
mobile varchar(20) //sender's mobile number
messages varchar(200) //the message sent
status(100) //user status
I need to find out the 5 most active usrs from this table. So is to find the users whose name appeared most often in the table and pass back their names. We can use MAX(Count) to easily get the most often one, but how to get the most 5? Please give me some highlights on this. Thanks a lot
I am newbie to SQL and I encountered a 'difficult' problem in development.Right now I have table that records all the SMS sent out by the customers. The table fields are defined as bellow:
indexID int(11) //primary key (auto increment)
sender varchar(50) //sender's nick name
datetime datetime //the time when sender sends out sms
mobile varchar(20) //sender's mobile number
messages varchar(200) //the message sent
status(100) //user status
I need to find out the 5 most active usrs from this table. So is to find the users whose name appeared most often in the table and pass back their names. We can use MAX(Count) to easily get the most often one, but how to get the most 5? Please give me some highlights on this. Thanks a lot