Re: MySQL and GROUP BY
| From: | Jon Farmer | Date: | Tue, 20 Nov 2001 15:18:23 +0000 |
| Subject: | Re: MySQL and GROUP BY | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75249@lists.php.net to get a copy of this message | ||
> At the moment I am doing something like this for my SQL statement
> (simplified for just the bit I need to figure out):
>
> SELECT * FROM My_Table ORDER BY Business_Name, Last_Name, First_Name;
>
> What I would _like_ to have happen is that the select list will end up
> sorted by business name as well as last name and then first name. At
> the moment this query is resulting in all business names (sorted) and
> then, following all business names, all last/first names (also sorted).
SELECT Concat(First_Name, " ", Last_Name, Business_Name) as Name From
My_Table order by Name
--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key