Subject | Re: Nasty query construct problem |
---|---|
Author | johanfredse |
Post date | 2003-11-13T07:55:01Z |
--- In firebird-support@yahoogroups.com, Lucas Franzen <luc@r...>
wrote:
in real life it's xxxx i want in the first column and whatever else
in the second column. The yyyy can be infinit number of variants!
I'm thinking of doing a datamoving routine before my actual sql that
moves each row into a new table and in that move put it in column one
or two and do a per row sum also.
After that it should be straigh forward for a sql query and grouping.
Cheers
/Johan
wrote:
>you've
> Johan,
>
> > The "artno" is used to select xxxx or yyyy for making it to two
> > columns in the result.
> >
> > Any ideas on how to make that kind of SP? Thats new for me!
> >
> > Thanks for helping.
> > /Johan
>
> The problem is that you have to take care for EVERY KIND of artno
> got since you want convert a "vertical" information (the value ofartno
> in your records) in a horizontal one (a column for each).columns
>
> So for every distinct artno you've got, you want to have two
> back (in your example you've got artno xxxx and yyyy and you wantproc.
> columns for: xxxx nett, xxxx gross, yyyy nett, yyyy gross)
>
> This is just impossible, columns that should be returned have to be
> defined in advance.
>
> If you really got just two artno values you can do it with a stored
> But before I'll write you an example it's better to ask if that'swhat
> you want! ;-)Hmm...it's even worse I think! In my example I used xxxx and yyyy but
>
>
> Regards
> Luc.
in real life it's xxxx i want in the first column and whatever else
in the second column. The yyyy can be infinit number of variants!
I'm thinking of doing a datamoving routine before my actual sql that
moves each row into a new table and in that move put it in column one
or two and do a per row sum also.
After that it should be straigh forward for a sql query and grouping.
Cheers
/Johan