Hi list,
 
 
 I'd like to generate arrays into a field for the result-set 
 by means of grouping...
 myTable >> ( MySQL 3.23.33 / MyISAM table )
 +--------+----------+
 |  id    |     type |
 +--------+----------+
 |  002   |     'CD' |
 |  002   |     'LP' |
 |  011   |    'DVD' |
 |  081   |     'CD' |
 |  081   |     'LP' |
 |  081   |    'DVD' |
 |  087   |     'MC' |
 |  087   |     'LP' |
 +--------+----------+
 
 myWish >>
 *** SELECT id, makeArray(type) FROM myTable GROUP BY id;
 +--------+-------------------+
 |  id    | ? makeArray(type) |
 +--------+-------------------+
 |  002   |       ('CD','LP') |
 |  011   |           ('DVD') |
 |  081   | ('CD','LP','DVD') |
 |  087   |       ('MC','LP') |
 +--------+-------------------+
 
 
 I know, when GROUPing, you can ask for a COUNT like:
 *** SELECT id, COUNT(*) FROM myTable GROUP BY id;
 +--------+----------+
 |  id    | COUNT(*) |
 +--------+----------+
 |  002   |        2 |
 |  011   |        1 |
 |  081   |        3 |
 |  087   |        2 |
 +--------+----------+
 
 
 
 How should I tackle this ?
 
 
 Thanks !
 Best Regards,
 
 Bart
 
 


---------------------------------------------------------------------
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

Reply via email to