Home » SQL & PL/SQL » SQL & PL/SQL » Query - Urgent (Merged)
Query - Urgent (Merged) [message #203381] Tue, 14 November 2006 23:56 Go to next message
deepak samal
Messages: 29
Registered: February 2005
Junior Member
I am getting data in below format as,

Id Data1 Data2 Data3
10 101
10 201
10 202
10 301
10 302


But I want to get data in below format without using any intermediate Table,

Id Data1 Data2 Data3
10 101 201 301
10 101 202 302

How can i ??

please send me soon please .

regards
deepak
Re: Query- Urgent [message #203389 is a reply to message #203381] Wed, 15 November 2006 00:15 Go to previous messageGo to next message
bala_id
Messages: 27
Registered: July 2005
Junior Member
Hi,

Your logic is perplexing. Please explain in detail
about your requirement.

Query For select - urgent [message #203403 is a reply to message #203381] Wed, 15 November 2006 00:53 Go to previous messageGo to next message
deepak samal
Messages: 29
Registered: February 2005
Junior Member
HI ,

i have again attached a file as this window does not support this format.

please send me the query . its urgent
  • Attachment: Query.sql
    (Size: 0.29KB, Downloaded 135 times)
Re: Query For select - urgent [message #203404 is a reply to message #203403] Wed, 15 November 2006 00:56 Go to previous messageGo to next message
deepak samal
Messages: 29
Registered: February 2005
Junior Member
Sorry ,
the attachement was wrong . i am sending it again.

regards
deepak
  • Attachment: Query.sql
    (Size: 0.31KB, Downloaded 124 times)
Re: Query For select - urgent [message #203414 is a reply to message #203404] Wed, 15 November 2006 01:40 Go to previous messageGo to next message
bala_id
Messages: 27
Registered: July 2005
Junior Member
Hi,
Still your requirement is not proper. Anyway try using the following query. I think this will fullfil your requirement.

SELECT A.DATA1,B.DATA2,C.DATA3 FROM
 (SELECT DATA1 FROM TEST WHERE DATA1 IS NOT NULL) A,
 (SELECT DATA2 FROM TEST WHERE DATA2 IS NOT NULL) B,
 (SELECT DATA3 FROM TEST WHERE DATA3 IS NOT NULL) C 


Please revert back, if you have any clarifications on this.


Thanks & Best Regards,
Bala
Re: Query For select - urgent [message #203417 is a reply to message #203403] Wed, 15 November 2006 01:50 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
deepak samal wrote on Wed, 15 November 2006 07:53
HI ,

i have again attached a file as this window does not support this format.

please send me the query . its urgent

If you would read the stickies in the Newbie forum, you would see how to format your post so you don't need these attachments.
Furthermore, you would see that it is not polite (or serve any purpose) to state that your requirement is urgent. It is neither our fault, nor our problem you started too late.

[Edit: and on top of that I merged two topics. Please continue in your original thread, instead of opening a new one if it is about the same issue]

[Updated on: Wed, 15 November 2006 01:58]

Report message to a moderator

Re: Query For select - urgent [message #203673 is a reply to message #203417] Thu, 16 November 2006 00:29 Go to previous message
SLakkaraju
Messages: 1
Registered: August 2005
Location: Hyderabad
Junior Member
Deepak,

Try the following query ...

SELECT ID, SUM(NVL(DATA1, 0)) DATA1, SUM(NVL(DATA2, 0)) DATA2, SUM(NVL(DATA3, 0)) DATA3
FROM MYTABLE
GROUP BY ID

Assumed the following:

> MYTABLE has not more than 3 records for each ID.
> Each record for a given ID, no two records have value
for the same DATA# column.

If this wasn't your requirement, do let me know.

HTH,

Shankar Lakkaraju
Previous Topic: Use of TEMP segment
Next Topic: using variable inside a stored proc
Goto Forum:
  


Current Time: Sat Dec 03 21:59:01 CST 2016

Total time taken to generate the page: 0.04453 seconds