Re: show required row first and then other remaining rows

From: Date: Thu, 25 Oct 2007 18:55:58 +0000
Subject: Re: show required row first and then other remaining rows
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-263671@lists.php.net to get a copy of this message
Sanjeev N wrote:
Hi, Consider the following case mysql> select *from names; +----+---------+------------+
| id | name    | phone      |
+----+---------+------------+ | 1 | sanju | 9845650000 | | 2 | sanjeev | 9972230000 | | 3 | puttu | 9900580000 |
|  4 | raju    | 9448110000 |
+----+---------+------------+ Now I want to display the row whose name is puttu (id=3) first and then want to display other rows in order (order by name) as follows +----+---------+------------+
| id | name    | phone      |
+----+---------+------------+ | 3 | puttu | 9900580000 |
|  4 | raju    | 9448110000 |
| 2 | sanjeev | 9972230000 | | 1 | sanju | 9845650000 | +----+---------+------------+ Can somebody tell me is it possible. If its possible then please help me to solve this problem. Actually I am fetching all the rows from this table to my php page and there if I choose some name then that should appear at top and rest should be below in name order.
SELECT * from names ORDER by name; Stephen

« previous php.general (#263671) next »