Brian Dunning wrote:
I'm not sure if this is a complex SQL query or a PHP array sorting
thing, but what's the best way to take this data:
Tom
Greg
Brian
Tom
Brian
Tom
And return the following results, sorted by number of records:
Tom - 3
Brian - 2
Greg - 1
Any thoughts?
I'm not
what is the 2? in the order by statement mean?
thanks
-Original Message-
From: Raúl Castro [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 03, 2004 6:20 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Best way to sort?
The best way is:
SELECT person_name, count(*)
FROM table_name
GROUP
Order by the 2nd column
what is the 2? in the order by statement mean?
thanks
-Original Message-
From: Raúl Castro [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 03, 2004 6:20 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Best way to sort?
The best way is:
SELECT person_name, count
: Friday, June 04, 2004 2:20 AM
Subject: RE: [PHP] Best way to sort?
what is the 2? in the order by statement mean?
thanks
-Original Message-
From: Raúl Castro [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 03, 2004 6:20 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Best way to sort
I'm not sure if this is a complex SQL query or a PHP array sorting
thing, but what's the best way to take this data:
Tom
Greg
Brian
Tom
Brian
Tom
And return the following results, sorted by number of records:
Tom - 3
Brian - 2
Greg - 1
Any thoughts?
--
PHP General Mailing List
Brian Dunning wrote:
I'm not sure if this is a complex SQL query or a PHP array sorting
thing, but what's the best way to take this data:
Tom
Greg
Brian
Tom
Brian
Tom
And return the following results, sorted by number of records:
Tom - 3
Brian - 2
Greg - 1
Any thoughts?
MySQL's
select thename, count(thename) from tablename order by thename asc group
by thename
Try this
-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 03, 2004 3:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Best way to sort?
I'm not sure if this is a complex
Angelo Zanetti [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
select thename, count(thename) from tablename order by thename asc group
by thename
or...
to sort by number of records
select name, count(name) as ncnt from table group by name order by ncnt desc
-- Rob
--
PHP
SELECT DISTINCT person_name, count(*)
FROM table_name
GROUP BY person_name
ORDER BY 2 DESC
I'm not sure if this is a complex SQL query or a PHP array sorting
thing, but what's the best way to take this data:
Tom
Greg
Brian
Tom
Brian
Tom
And return the following
The best way is:
SELECT person_name, count(*)
FROM table_name
GROUP BY person_name
ORDER BY 2 DESC
- Original Message -
From: Daniel Clark [EMAIL PROTECTED]
To: Brian Dunning [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, June 03, 2004 10:30 AM
Subject: Re: [PHP] Best way
Hello,
I need to manipulate, the following data in a number of diffierent ways
(specifics follow).
Telephone extension number - 4 digits in the range 2000-2119
Total time on phone - seconds integer values
Total No. of calls - integer value
Name - A persons name
I'm purposely NOT using a
-Original Message-
From: Mark Cubitt [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2003 12:43
I need to manipulate, the following data in a number of
diffierent ways
I'm storing the data in a multidemensional array, the
stucture of which
is below, and I need to sort it by
12 matches
Mail list logo