Re: PHP and MySQL sorting using COUNT
| From: | @ Edwin | Date: | Wed, 13 Nov 2002 14:25:17 +0000 |
| Subject: | Re: PHP and MySQL sorting using COUNT | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124220@lists.php.net to get a copy of this message | ||
Hello,
<ed@home.homes2see.com> wrote:
>
> I'm sorting records using COUNT with the following mysql command
>
> $result = mysql_query ("SELECT company_name, agent_name, count(*) FROM
> $cur_listings GROUP BY company_name, agent_name");
>
> Running this in MySQL does exactly what I need it to do but how do I echo
> the COUNT portion of the array? I know the company_name would be
> $row['company_name'] and agent_name is $row['agent_name'];
You can find something about "aliases" here:
http://www.mysql.com/doc/en/SELECT.html
- E