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
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
@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
: 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
, 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
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)
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
: 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