Subject Re: [firebird-support] Re: SQL Question
Author Philippe Makowski
Michael Vilhelmsen [08-04-25 14.49] :
> I would like to fetch all rows as shown above.
> Only I dont know the exact amount of ros or columns.
> At least 1 of each ....
>
If you know one of them you can write something like that :
(I suppose you know the different distinct values for X_AKSE)

SELECT Y_AKSE,
SUM(CASE WHEN X_AKSE='BLACK' THEN FIELDVALUE ELSE NULL END) BLACK,
SUM(CASE WHEN X_AKSE='WHITE' THEN FIELDVALUE ELSE NULL END) WHITE,
SUM(CASE WHEN X_AKSE='GREY' THEN FIELDVALUE ELSE NULL END) GREY
FROM MYTABLE GROUP BY 1