SORU
25 Aralık 2011, Pazar


TARAFINDAN GROUP_CONCAT SİPARİŞ

a table I gibi:

 ----------- ------- ------------ 
| client_id | views | percentage |
 ----------- ------- ------------ 
|         1 |     6 |         20 |
|         1 |     4 |         55 |
|         1 |     9 |         56 |
|         1 |     2 |         67 |
|         1 |     7 |         80 |
|         1 |     5 |         66 |
|         1 |     3 |         33 |
|         1 |     8 |         34 |
|         1 |     1 |         52 |

group_concat denedim:

SELECT li.client_id, group_concat(li.views) AS views,  
group_concat(li.percentage) FROM li GROUP BY client_id;

 ----------- ------------------- ----------------------------- 
| client_id | views             | group_concat(li.percentage) |
 ----------- ------------------- ----------------------------- 
|         1 | 6,4,9,2,7,5,3,8,1 | 20,55,56,67,80,66,33,34,52  |
 ----------- ------------------- ----------------------------- 

Ama sırayla görüşlerini almak istiyorum

 ----------- ------------------- ---------------------------- 
| client_id | views             | percentage                 |
 ----------- ------------------- ---------------------------- 
|         1 | 1,2,3,4,5,6,7,8,9 | 52,67,33,55,66,20,80,34,56 |
 ----------- ------------------- ---------------------------- 

CEVAP
25 Aralık 2011, Pazar


Bu şekilde: GROUP_CONCAT işlev içinde ORDER BY kullanabilirsiniz

SELECT li.client_id, group_concat(li.views ORDER BY li.views ASC) AS views, 
group_concat(li.percentage ORDER BY li.percentage ASC) 
FROM li GROUP BY client_id

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Angry Paintballer

    Angry Paintb

    8 Ocak 2012
  • cosmicrocketman

    cosmicrocket

    17 NİSAN 2006
  • XxMinayaxX1

    XxMinayaxX1

    9 Mayıs 2012