![]() |
| |||
| Hi, How can I query my table so that it returns a list of "group_concat"s grouping by N? E.g.: select group_concat(field) from t where t.field2="condition"; so that I get the results as, for example, group_concats of N=10: 248,876,3158,12183,12242,16472,18008,18496,20835,2 7812 27840,28939,28950,30867,31961,32759,33358,59819,59 833,91740 99376,105623,117618,117733,166576,184408,184424,28 5010,285021,289723 291332,304954,324694,324761,324791,331684,340550,3 73651,388878,401832 Cheers, Albert. |
| |||
| On Mon, 19 May 2008 16:27:45 +0200, avilella <avilella@gmail.com> wrote: > Hi, > > How can I query my table so that it returns a list of "group_concat"s > grouping by N? > > E.g.: > > select group_concat(field) from t where t.field2="condition"; > > so that I get the results as, for example, group_concats of N=10: > > 248,876,3158,12183,12242,16472,18008,18496,20835,2 7812 > 27840,28939,28950,30867,31961,32759,33358,59819,59 833,91740 > 99376,105623,117618,117733,166576,184408,184424,28 5010,285021,289723 > 291332,304954,324694,324761,324791,331684,340550,3 73651,388878,401832 > > Cheers, SET @var = -1; SELECT GROUP_CONCAT(fld), FLOOR((@var := @var + 1)/ 10) AS grouper FROM table GROUP BY grouper; -- Rik Wasmus ....spamrun finished |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |