show required row first and then other remaining rows
| From: | Sanjeev N | Date: | Thu, 25 Oct 2007 18:45:19 +0000 |
| Subject: | show required row first and then other remaining rows | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263669@lists.php.net to get a copy of this message | ||
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.
Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit
your website URL
http://webhosting.sanchanworld.com - Choose your
best web hosting plan