Home » SQL & PL/SQL » SQL & PL/SQL » is there a simple way to do this?
is there a simple way to do this? [message #24734] Mon, 03 March 2003 17:18 Go to next message
Jay
Messages: 127
Registered: October 1999
Senior Member
I have the following:
create table t1 (p1 number(6), p2 number(6),c1 varchar2(50),primary key (p1,p2) );

insert into t1 values(1, 1,'a');

insert into t1 values(1, 2,'b');

Now I do:
select c1 from t1 where p1=1;

I will got two rows. a and b separately.
how can I consolidate the result to only ONE row. I want something like
a b
instead of
a
b

Thanks.
Re: is there a simple way to do this? [message #24735 is a reply to message #24734] Mon, 03 March 2003 17:24 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Are you looking for the string 'a b' to come back, or those values in separate columns?

If the former, see the recent thread:

http://www.orafaq.net/msgboard/sql/messages/19279.htm

If the latter, and there is a known upper bound to how many rows would be combined, you are looking for a pivot query:

http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:766825833740
Previous Topic: What is the difference between METADATA AND RAW DATA?
Next Topic: Outer join
Goto Forum:
  


Current Time: Sun Apr 05 06:37:30 CDT 2026