Re: Re: Does not MySql support "Order By" in SelectStatement?
| From: | Edward Wong | Date: | Mon, 12 Jun 2000 02:37:36 +0000 |
| Subject: | Re: Re: Does not MySql support "Order By" in SelectStatement? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1585@lists.php.net to get a copy of this message | ||
But I really can't run an "order by" Select statement.
The statement is as below:
mysql> select * from table01 order by age group by age;
ERROR 1064: You have an error in your SQL syntax near 'group by age' at line 1
mysql> select * from table01
-> ORDER BY Age;
And the command line dies after this execute.
What can I do?
----- Original Message -----
From: "Kris Dahl" <krislists@toolhouse.com>
To: "Edward Wong" <wyuanzheng@21cn.com>; "PHP list"
<php-general@lists.php.net>
Cc: "PHP Database" <php-db@lists.php.net>
Sent: Saturday, June 10, 2000 1:34 AM
Subject: [PHP-DB] Re: [PHP-GENERAL] Does not MySql support "Order By" in SelectStatement?
> on 6/9/00 1:08 AM, Edward Wong at wyuanzheng@21cn.com wrote:
>
> > I installed a MySql 3.2 Alpha on Windows 2000, and connected to it within
> > PHP3, but every time I want to select from a table with "order by" suffix,
> > mySql always crashs.(eg: "select * from myTable1 order by Age"), Does not
> > mySql support order by? If then, what's the use of mySql? Or does it own to
> > PHP?
>
> MySQL does support the order by clause.
>
> If the column didn't exist you would get an error saying:
>
> Error 1054: Unknown Column 'Age' in 'order clause'
>
> So the column is there, and it should be working properly.
>
> Try perhaps
>
> SELECT * from myTable1 order by Age DESC
>
> which should switch the order around.
>
> -k
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net