View previous topic :: View next topic
|
Author |
Message |
GANAPATH
New User
Joined: 06 Mar 2006 Posts: 35
|
|
|
|
Hi,
I have a table with 5000 rows in it. Iam trying to add that data as a single row into another table.
Is there a way i can loop in the select stamenent and subtring it.
Ex: select testchar from test_table1;
ravi
madhu
kiran
three rows selected
i would like to insert this data as a single row in another table like this
ravi madhu kiran
is there a way i can do this through simple SQL(insert and select with substr).
thanks,
Ganapath |
|
Back to top |
|
|
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
SELECT A.TEST_CHAR1,
B.TESTCHAR1,C.TESTCHAR1
FROM TEST_TABLE1 A
TEST_TABLE1 B
TEST_TABLE1 C
WHERE
B.TESTCHAR1 = A.TESTCHAR1
C.TESTCHAR1 = A.TESTCHAR1
AND A.TS_TESTCHAR1 < B.TS_TESTCHAR1
AND B.TS_TESTCHAR1 < C.TS_TESTCHAR1
AND C.TS_TESTCHAR1 < D.TS_TESTCHAR1;
this will concatenate the names .
Write this select query inside the insert query.
Thanks,
KS |
|
Back to top |
|
|
jtop
New User
Joined: 30 Mar 2006 Posts: 1
|
|
|
|
So you want him to write a inner SQL with 5000 joins
BTW, what is the joining condition between
B.TESTCHAR1 = A.TESTCHAR1
C.TESTCHAR1 = A.TESTCHAR1
And what table does this D.TESTCHAR1 point to? or is it a typo? |
|
Back to top |
|
|
|