Hello.


Yes. For example:



mysql> select count(*) from yo group by a order by a desc;

+----------+

| count(*) |

+----------+

|        6 |

|       12 |

|        3 |

+----------+

3 rows in set (0.00 sec)



mysql> select count(*) from yo group by a order by a asc;

+----------+

| count(*) |

+----------+

|        3 |

|       12 |

|        6 |

+----------+

3 rows in set (0.00 sec)



mysql> show create table yo \G;



Create Table: CREATE TABLE `yo` (

  `a` int(11) default NULL

  ) ENGINE=MyISAM DEFAULT CHARSET=latin1





mysql> select * from yo;

+------+

| a    |

+------+

|    1 |

|    1 |

|    2 |

|    1 |

|    1 |

|    2 |

|    1 |

|    1 |

|    2 |

|    1 |

|    1 |

|    2 |

|    0 |

|    1 |

|    1 |

|    2 |

|    0 |

|    1 |

|    1 |

|    2 |

|    0 |





"N. Kavithashree" <[EMAIL PROTECTED]> wrote:

> 

> hello,

> 

> can we give the same field name in group by and order by ?

> 

> Eg. select count(*) from table group by filedname1 orderby filedname1

> desc;

> 

> =====

> kavi

> 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to