Home » SQL & PL/SQL » SQL & PL/SQL » How to aggregate similar rows into one
How to aggregate similar rows into one [message #299290] Mon, 11 February 2008 04:18 Go to next message
Vackar
Messages: 81
Registered: October 2007
Member
Hi

I have this table

-------------------------------------------------------
SomeValue      SomeLinkValue           SomeOtherValue
-------------------------------------------------------
a                   xx1.0                     1.5
a                   xx1.2                     1.5
a                   xx1.3                     1.5
a                   xx1.4                     1.5
a                   xx1.5                     1.5
a                   xx1.6                     1.5
b                   xx2.0                     9.6
c                   xx3.0                     7.2
c                   xx3.5                     7.2
d                   xx4.7                     8.2
e                   xx5.2                     6.4
e                   xx5.3                     6.4
f                   xx6.0                     0.2
g                   xx7.0                     1.8
-------------------------------------------------------



Does anyone know of a funtion (or any other method) that would allow me to do this:


---------------------------------------------------------------
SomeValue      SomeLinkValue                       SomeOtherValue
---------------------------------------------------------------
a       x1.0, xx1.2, xx1.3, xx1.4 , xx1.5, xx1.6      1.5
b                   xx2.0                             9.6
c                   xx3.0, xx3.5                      7.2
d                   xx4.7                             8.2
e                   xx5.2, xx5.3                      6.4
f                   xx6.0                             0.2
g                   xx7.0                             1.8
---------------------------------------------------------------



I know this is a really strange this to want to do, and I know that it violates a bazillion sql principles about multiple values, but I need a way of aggregating these values together and I can't do it at the application level because the datasets are huge, so it means having to do it at the database level.

Thanks in advance,
Vackar
Re: How to aggregate similar rows into one [message #299293 is a reply to message #299290] Mon, 11 February 2008 04:22 Go to previous message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Search for "pivot".

Regards
Michel
Previous Topic: Automatic Refresh of Materialize View
Next Topic: Trim function on table
Goto Forum:
  


Current Time: Wed Feb 12 21:10:53 CST 2025