Re: help with a sql statement
tech user wrote: Add an alias for the subquery select * from ( select ) my_alias where dd = 3; Better, use a having clause and eliminate the subquery. Odds are it will be more efficient in MySQL. How to replace the original one with a having statement? Thanks again. select uin,count(*) as dd from active_users where date = date_add(curdate(),interval -30 day) group by uin having count(*) =3; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
help with a sql statement
hello, I try to execute this sql in mysql shell,but got error as: mysql select * from (select uin,count(*) as dd from active_users where date = date_add(curdate(),interval -30 day) group by uin) where dd =3; ERROR 1248 (42000): Every derived table must have its own alias But I can execute the sql statement of select uin,count(*) as dd from active_users where date = date_add(curdate(),interval -30 day) group by uin successfully. How to fixup it? thanks! Get the name you always wanted with the new y7mail email address. www.yahoo7.com.au/y7mail -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: help with a sql statement
tech user wrote: hello, I try to execute this sql in mysql shell,but got error as: mysql select * from (select uin,count(*) as dd from active_users where date = date_add(curdate(),interval -30 day) group by uin) where dd =3; ERROR 1248 (42000): Every derived table must have its own alias But I can execute the sql statement of select uin,count(*) as dd from active_users where date = date_add(curdate(),interval -30 day) group by uin successfully. How to fixup it? thanks! Get the name you always wanted with the new y7mail email address. www.yahoo7.com.au/y7mail Add an alias for the subquery select * from ( select ) my_alias where dd = 3; Better, use a having clause and eliminate the subquery. Odds are it will be more efficient in MySQL. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: help with a sql statement
Add an alias for the subquery select * from ( select ) my_alias where dd = 3; Better, use a having clause and eliminate the subquery. Odds are it will be more efficient in MySQL. How to replace the original one with a having statement? Thanks again. Get the name you always wanted with the new y7mail email address. www.yahoo7.com.au/y7mail -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Help needed for SQL statement
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]
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]
Help with an SQL statement
Thanks for everyone's help with the dat question now I would like to know if someone could help me with another question. I have a table called COUNTER and a field in the table called HITS in an SQL statement I would like to update this field by adding 1 to it's current value any ideas? Thanks, Mike - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php