Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: pivot/transform in Oracle
oaksong_at_hotmail.com wrote:
> And the answer was..........
>
> I needed to include the NAME, as well as the other fields.
>
> I was then able to perform a GROUP BY against the second result.
>
> The final code looked like:
>
> select Desc,Time,NAME,
> max(decode....etc.) sunday
> etc
> from
> (select basic from ...)
> )
> Group by desc,time, NAME
>
> That eliminated the blanks, but forced the retention of all the names.
> (In case anyone should come across this and need a resolution.)
> And I simply ignore the NAME field for the reports.
>
>
> oaksong_at_hotmail.com wrote:
>
>>Well...it was worth a try. :) >> >>The actual results without MAX are, for instance with Watch 1, 5 rows >>with D'Arcy in 4 of them and Jame Robin, one Name for each day of the >>week in which the individual is listed in the basic output. So it looks >>a bit like a sparse checker board. >> >>And I misphrased my comment after the second grid shown above where the >>sentance begins 'Notice that I get', it should have said 'Notice that I >>should like to get'. >> >>As I stated above, using MAX, I only get one record for Watch 1 (or any >>of the Watchs) since MAX takes only the first NAME encountered and >>ignores the rest. >> >>Thanks for following this.
SQL> SELECT keyword
2 FROM v$reserved_words
3 WHERE keyword LIKE 'NAME%';
KEYWORD
-- Daniel A. Morgan http://www.psoug.org damorgan_at_x.washington.edu (replace x with u to respond)Received on Wed Feb 01 2006 - 12:13:46 CST