Home » SQL & PL/SQL » SQL & PL/SQL » NEED FOR QUERY (10G)
NEED FOR QUERY [message #408247] Mon, 15 June 2009 07:53 Go to next message
mamalik
Messages: 270
Registered: November 2008
Location: Pakistan
Senior Member

ASLAM-O-ALAIKUM DEAR ALL

i have following data in a table.Following is data example.
select 1,'ABC' from dual
union
select 1,'DEF' FROM DUAL
UNION
SELECT 1,'GHI' FROM DUAL
union
select 2,'JKL' from dual
union
select 2,'MNO' FROM DUAL
UNION
SELECT 3,'GHI' FROM DUAL


i need follwoing result from query
1  ABC DEF GHI
2  JKL MNO
3  GHI


How is it possible?

Thanks in advance for your precious time.

Regards.
Asif.


Re: NEED FOR QUERY [message #408254 is a reply to message #408247] Mon, 15 June 2009 08:03 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
1/ Don't post your title in UPPER case
2/ Post a useful and meaningful title
3/ Post your version with 4 decimals
4/ Search BEFORE posting, this is a FAQ

Regards
Michel
Re: NEED FOR QUERY [message #408257 is a reply to message #408247] Mon, 15 June 2009 08:52 Go to previous messageGo to next message
_jum
Messages: 577
Registered: February 2008
Senior Member
This operation/technique ist called PIVOT, you find a question/answer about weekly.
Re: NEED FOR QUERY [message #408279 is a reply to message #408257] Mon, 15 June 2009 09:55 Go to previous message
joicejohn
Messages: 327
Registered: March 2008
Location: India
Senior Member
I think a better term will be String Aggregation.

To OP,
The following links might be an interesting read for you:
String Aggregation Techniques
SQL Snippets: Rows To Strings

Hope these helps.
Regards,
Jo

[Updated on: Mon, 15 June 2009 09:56]

Report message to a moderator

Previous Topic: Syntax to create table space
Next Topic: move TABLESPACE
Goto Forum:
  


Current Time: Sat Feb 15 00:07:08 CST 2025