SQL regroup by column values into row
===

I have a software that gives me data that look like those.

>| Date |   Programme    | Groupe | Rat | Actif | RFS | Inactif |  Relevance  |   Etape  | 

>|120227| ANS-FR2-85s TO |   5    |  9  |  20   |  5  |   10    | Rats finaux | Training |

>|120228| ANS-FR2-85s TO |   5    |  9  |  10   |  3  |    4    | Rats finaux | Training |

>|120229| ANS-FR2-85s TO |   5    |  9  |  100  | 20  |   50    | Rats finaux |    ShA   |

>|120230| ANS-FR2-85s TO |   5    |  9  |  100  | 20  |   50    |    Exclus   | Training |

>|120231| ANS-FR2-85s TO |   5    |  9  |  100  | 20  |   50    | Rats finaux | Training |

>|120227| ANS-FR2-85s TO |   5    | 10  |  20   |  5  |   10    | Rats finaux | Training |

>|120228| ANS-FR2-85s TO |   5    | 10  |  10   |  3  |    4    | Rats finaux | Training |

>|120229| ANS-FR2-85s TO |   5    | 10  |  100  | 20  |   50    | Rats finaux |    ShA   |

>|120230| ANS-FR2-85s TO |   5    | 10  |  100  | 20  |   50    |    Exclus   | Training |

I would like to be able to create a **view** that will **regroup the 'RFS' according to the 'Rat'** values and **applying criteria for 'Etape' and 'Relevance'**

Criteria

 - WHERE Relevance='Rats finaux'
 - WHERE Etape='Training'

It also is important to notice that the number of row is variable. So I could have like in this exemple 2 or 3 rows but also up to 20 rows. I think that maybe a loop might be great rather than calling each specific lines.

So it would look like this:

>| Groupe | Rat | D1  | D2  |  D3  |

>|   5    |  9  |  5  |  3  |  20  |

>|   5    | 10  |  20 | 10  |      |

Thanks a lot