RE: Group By over many colums

2006-01-19 Thread Patrick Herber
I would suggest a union SELECT name, count(*) FROM (SELECT name1 as name from mytable union select name2 as name from mytable union select name3 as name from table) GROUP BY name but perhaps there's a better way... Regards, Patrick -Original Message- From: Critters [mailto:[EMAIL

Re: Group By over many colums

2006-01-19 Thread Marco Neves
Hi, To this on I just see a solution, that depends on sub-selects, so it's available from Mysql 4.1 forward: SELECT name,count(*) from ((SELECT name1 name FROM tablename) UNION ALL (SELECT name2 name FROM tablename) UNION ALL (SELECT name3 name FROM tablename)) tab GROUP by name; Hope this

Re: Group By over many colums

2006-01-19 Thread Critters
@lists.mysql.com Cc: Critters [EMAIL PROTECTED] Sent: Thursday, January 19, 2006 3:34 PM Subject: Re: Group By over many colums Hi, To this on I just see a solution, that depends on sub-selects, so it's available from Mysql 4.1 forward: SELECT name,count(*) from ((SELECT name1 name FROM tablename) UNION ALL

Re: Group By over many colums

2006-01-19 Thread Marco Neves
: Marco Neves [EMAIL PROTECTED] To: mysql@lists.mysql.com Cc: Critters [EMAIL PROTECTED] Sent: Thursday, January 19, 2006 3:34 PM Subject: Re: Group By over many colums Hi, To this on I just see a solution, that depends on sub-selects, so it's available from Mysql 4.1 forward: SELECT name

Re: Group By over many colums

2006-01-19 Thread Critters
, January 19, 2006 3:34 PM Subject: Re: Group By over many colums Hi, To this on I just see a solution, that depends on sub-selects, so it's available from Mysql 4.1 forward: SELECT name,count(*) from ((SELECT name1 name FROM tablename) UNION ALL (SELECT name2 name FROM tablename) UNION ALL (SELECT

Re: Group By over many colums

2006-01-19 Thread Marco Neves
Hi Critters, The problem is that as your MySQL is 4.0.21 don't suport the subselect you would need to do the group. I was thinking and you have another alternative: CREATE TEMPORARY table tdata (SELECT f1 as 'domain' from sends) union all (SELECT f2 as 'domain' from sends)

Re: Group By over many colums

2006-01-19 Thread Critters
PROTECTED] Cc: mysql@lists.mysql.com Sent: Thursday, January 19, 2006 4:20 PM Subject: Re: Group By over many colums Hi Critters, The problem is that as your MySQL is 4.0.21 don't suport the subselect you would need to do the group. I was thinking and you have another alternative: CREATE TEMPORARY

Re: Group By over many colums

2006-01-19 Thread Marco Neves
: Thursday, January 19, 2006 4:20 PM Subject: Re: Group By over many colums Hi Critters, The problem is that as your MySQL is 4.0.21 don't suport the subselect you would need to do the group. I was thinking and you have another alternative: CREATE TEMPORARY table tdata (SELECT f1 as 'domain