Home » SQL & PL/SQL » SQL & PL/SQL » Analytic functions - HELP !!!!! (Oracle DB - Version 10.2.0.3.0)
Analytic functions - HELP !!!!! [message #360330] Thu, 20 November 2008 07:38 Go to next message
f.bonavia
Messages: 2
Registered: November 2008
Location: turin
Junior Member
Hi to all,

I have the table TEST_DATA with these values:

------------------------------------------
ID| DATA_TMP |VALUE!
------------------------------------------
100 | 23/11/2008 12:00:00 AM | 1
100 | 23/11/2008 12:15:00 AM | 2
100 | 23/11/2008 12:30:00 AM | 3
100 | 23/11/2008 12:45:00 AM | 4
100 | 23/11/2008 13:00:00 AM | 5
100 | 23/11/2008 13:15:00 AM | 6
100 | 24/11/2008 12:00:00 AM | 9
100 | 24/11/2008 12:15:00 AM | 8
100 | 24/11/2008 12:30:00 AM | 7
100 | 24/11/2008 12:45:00 AM | 6
100 | 24/11/2008 13:00:00 AM | 5
100 | 24/11/2008 13:15:00 AM | 3

My output must be:

-----------------------------------------------------------
ID | DATA_TMP | V_1 | V_2 | V_3 | V_4 | V_5 | V_6|
-----------------------------------------------------------

100 | 23/11/2008 | 1 | 2 | 3 | 4 | 5 | 6 |
100 | 24/11/2008 | 9 | 8 | 7 | 6 | 5 | 3 |

Does it exists an oracle query to find out this result ?

Thanks a lot
Francesco

[Updated on: Thu, 20 November 2008 07:42]

Report message to a moderator

Re: Analytic functions - HELP !!!!! [message #360331 is a reply to message #360330] Thu, 20 November 2008 07:40 Go to previous messageGo to next message
joy_division
Messages: 4642
Registered: February 2005
Location: East Coast USA
Senior Member
I wonder why you thought analytic functions would be used here. Do a search for "pivot" and you'll see many examples of I think what you are looking for.
Re: Analytic functions - HELP !!!!! [message #360333 is a reply to message #360330] Thu, 20 November 2008 07:49 Go to previous messageGo to next message
f.bonavia
Messages: 2
Registered: November 2008
Location: turin
Junior Member
Thank you Joy,

now I'm searching "Pivot" example.

Francesco
Re: Analytic functions - HELP !!!!! [message #360407 is a reply to message #360333] Thu, 20 November 2008 21:23 Go to previous message
Kevin Meade
Messages: 2101
Registered: December 1999
Location: Connecticut USA
Senior Member
Try these:

A Simple Example of Oracle Analytics: Running Totals

Example of Data Pivots in SQL (rows to columns and columns to rows)

Kevin Meade's blog

Good luck, Kevin
Previous Topic: Decrease the length of a column with select
Next Topic: DAL & GF generator for packages in Oracle ...
Goto Forum:
  


Current Time: Wed Dec 07 20:36:47 CST 2016

Total time taken to generate the page: 0.06865 seconds