Subject Re: [firebird-support] Re: SQL Question
Author Fidel Viegas
On Fri, Apr 25, 2008 at 12:10 PM, Michael Vilhelmsen
<Michael.Vilhelmsen@...> wrote:

>
> Any combination is allowed.
> There are only 3 fields in the table.
> Its something that comes from a grid.
>
> So it has an x columns and y rows with fieldvalue in them.
>
> It can be something like this:
>
> A B C D E F G...
> AA 1 2 3 4 5 6 7...
> BB 8 8 8 8 8 8 8...
> CC 9 10 12 14 16 18 20...
> DD 21 31 41 51 61 71 81...
> ....
>
> It think its called "pivot" or something a like in access.
>
> But Im not sure....
>
> Point is - There can be many rows and many columns.
>
> 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 ....

That is something too complex for SQL. You need to know the number of
columns being returned.

You can do it in a stored procedure that returns a varchar with
maximum size allowed, but even so, you will be limited to the maximum
length of a varchar. You would have to manipulate the data returned
from the stored procedure on the client side as well. Another solution
is to do it all on the client side. Retrieve the rows from the table
and then build dynamic arrays in whichever language you are using.

Maybe someone has a better suggestion. So, you'll have to be patient
and wait for someone to answer that for you.

Fidel.