bntconan
04-06-2007, 06:51 AM
I have a table:
id date status
====================
1 03/01/2006 W
1 02/01/2006 L
1 01/01/2006 L
1 31/12/2005 W
...
2 03/01/2006 L
2 02/01/2006 L
2 01/01/2006 W
2 31/12/2005 W
...
3 03/01/2006 W
3 02/01/2006 W
3 01/01/2006 W
3 31/12/2005 W
...
What I want is to concat the field status showing the latest 5 results, like this:
id status
=========
1 WLLWL
2 LLWWL
3 WWWWW
I have tried to use concat, but i can't get the desired one. Any idea to do that?
Thanks!
id date status
====================
1 03/01/2006 W
1 02/01/2006 L
1 01/01/2006 L
1 31/12/2005 W
...
2 03/01/2006 L
2 02/01/2006 L
2 01/01/2006 W
2 31/12/2005 W
...
3 03/01/2006 W
3 02/01/2006 W
3 01/01/2006 W
3 31/12/2005 W
...
What I want is to concat the field status showing the latest 5 results, like this:
id status
=========
1 WLLWL
2 LLWWL
3 WWWWW
I have tried to use concat, but i can't get the desired one. Any idea to do that?
Thanks!