Is this what you are looking for: SELECT clone_ids, COUNT(DISTINCT(gene_ids)) as count_genes FROM table_name GROUP BY clone_ids
or SELECT clone_ids, COUNT(gene_ids) as count_genes FROM table_name GROUP BY clone_ids Hope this helps, Alvaro ----- Original Message ----- From: "Xiaobo Chen" <[EMAIL PROTECTED]> To: <mysql@lists.mysql.com> Sent: Monday, October 24, 2005 11:43 PM Subject: Help needed for SQL statement > Hi, > > I have such a situation: > > There is a table with gene_ids and clone_ids. Each gene only resides on a > single clone and each clone may contain multiple genes. How do would I > find how many genes are on each and every clone? > > Thanks in advance. > > X.Chen > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]