Possible Duplicate:
mysql converting multiple rows into columns in a single row
i have a mysql table like this:
id |  p |  c  |  v
1     p1   10    1
2     p1   20    2
3     p1   30    3
4     p2   40    1
5     p2   50    2
6     p2   60    3
now i need to run a sql and get result like this:
p  |  as_c1 | as_c2 | as_c3
p1     10       20      30
p2     40       50      60
i used this query but it's not enough:
select 
p, 
c as as_c1,
c as as_c2,
c as as_c3
from test_tbl group by p, c
i searched every where, is this possible? i just need some guide.