All row data in a single column
i have a table with the following data
id name age salary dept city state country
1 abcd 22 20000 IT X Y XYZ
2 efgh 23 30000 IT X Y XYZ
i need the output as
1,abcd,22,20000,IT,X,Y
2,efgh,23,30000,IT,X,Y
in a single column separated by a comma(,)
is it possible to get?
please any one help me out with the sql/PL SQL query
select col1 || ',' || col2 || ',' || ...
Similar Messages
-
Merging 2 rows data into a single column in OBIEE
Hi All,
Requirement is "Merging 2 rows into a single column"
Scenario: data from table called "transactions_table"
Id
transaction no
transaction name -------------------------------quantity
100
1
abc
1000
100
2
def
2000
Required out put:
Id
Transactions & Quantity
100
abc(1000),def(2000)
Please provide me solution, and let me know if any additional information is required.
Thanks in advance to all of you.can you please share your data like below
column1, column2 .....
and where are you trying to do this? at answer or bi admin tool?
there are a few ways to do this. -
Merging 2 rows data into a single column in OBIEE 11g
Hi All,
Requirement is "Merging 2 rows into a single column"
Scenario: data from table called *"transactions_table"*
Id ------------- transaction no ----------------------- transaction name -------------------------------quantity
100 ----------- 1 ----------------------- abc ------------------------------ 1000
100 ----------- 2 ------------------------ def ------------------------------ 2000
Required out put:
Id ----------------- Transactions & Quantity
100 -------------- abc(1000),def(2000)
Please provide me solution, and let me know if any additional information is required.
Thanks in advance to all of you.
Regards,
chrscheck the below link, that may help you.
Re: Horizontal value display
If it is helpful, please mark as correct or helpful -
All Rows in to a Single Column?
Hi,
I am Using Oracle 11g Database Release 1,I am try to get the Primary Column for a Table in My Database Normally We get the Output as
Header
Column1
Column2
Column3
But I need the Output as
Header
Column1,Column2,Column3
Please Advice
Thank U
SHANHi,
you could use Pivot function in Oracle since you are in 11g, please see the link.
http://www.oracle.com/technology/pub/articles/oracle-database-11g-top-features/11g-pivot.html
If in 10G.
http://www.orafaq.com/node/55
thanks -
Using sql load insert multiple fields data into a single column in database
Hi ,
I have my log file in sun OS box something like this
=======
(07/29/2009 00:02:24.467) 367518 (07/29/2009 00:02:26.214) 949384011
(07/29/2009 00:02:26.236) 3675 (07/29/2009 00:02:28.207) 949395117
(07/29/2009 00:02:28.240) 337710 (07/29/2009 00:02:30.621) 949400864
=============
I am trying to insert the data into oracle data base as follows.
=============================
column1 : (07/29/2009 00:02:24.467)
column2 : 367518
column3 : (07/29/2009 00:02:26.214)
column4 : 949384011
===========================
Can anyone help me with the control file format?
someone suggested me the code below.
==========
LOAD DATA
INFILE 'D:\work\load.txt'
INTO TABLE sample
(col1 POSITION(02:24) char,
col2 POSITION(27:32) INTEGER EXTERNAL,
col3 POSITION(35:57) CHAR,
col4 POSITION(60:68) INTEGER EXTERNAL
===========
but this works only for the fixed length data? Please helpuser11744904 wrote:
Hi ,
I have my log file in sun OS box something like this
=======
(07/29/2009 00:02:24.467) 367518 (07/29/2009 00:02:26.214) 949384011
(07/29/2009 00:02:26.236) 3675 (07/29/2009 00:02:28.207) 949395117
(07/29/2009 00:02:28.240) 337710 (07/29/2009 00:02:30.621) 949400864
=============
I am trying to insert the data into oracle data base as follows.
=============================
column1 : (07/29/2009 00:02:24.467)
column2 : 367518
column3 : (07/29/2009 00:02:26.214)
column4 : 949384011
===========================
Can anyone help me with the control file format?
someone suggested me the code below.
==========
LOAD DATA
INFILE 'D:\work\load.txt'
INTO TABLE sample
(col1 POSITION(02:24) char,
col2 POSITION(27:32) INTEGER EXTERNAL,
col3 POSITION(35:57) CHAR,
col4 POSITION(60:68) INTEGER EXTERNAL
===========
but this works only for the fixed length data? Please helpIs the requirement to load all data in a single column or multiple columns? The thread subject and body are conflicting. -
When I import a text file(comma separated) into a numbers spreadsheet all the data goes into one column instead of individual columns based on the comma separators. Excel allows you to do this during the import.. Is there a way to accomplish this in numbers without opening it in Excel and the importing into Numbers.
Your user info says iPad. This is the OS X Numbers forum. Assuming you are using OS X… Be sure the file is named with a .csv suffix.
(I don't have an iPad, so I don't know the iOS answer.) -
Getting parent-child data from a single column in a table
Hi,
I have a parent-child data in a column.
Eg:
0
00
01
010
011
1
10
11
These values are present in the single column itself. My need is to get the parent values for the given child value.
For eg: If I am giving the input as 011, the query should return all its parents, i.e. 01 and 0
Could you please give me any inputs on this?
Thanks,
GVFrank Kulash wrote:
Assuming that each child's id is formed by adding exactly one character to the end of its parent's id:
SELECT id
FROM table_x
START WITH id = :target_id
CONNECT BY PRIOR id LIKE id || '_';
Small tweak to yours Frank if it's just the parents that need identifying...
SQL> ed
Wrote file afiedt.buf
1 with t as (select '0' as x from dual union all
2 select '00' from dual union all
3 select '01' from dual union all
4 select '010' from dual union all
5 select '011' from dual union all
6 select '1' from dual union all
7 select '10' from dual union all
8 select '11' from dual)
9 -- end of test data
10 SELECT x
11 FROM t, (select '&required' as req from dual) req
12 WHERE x != req.req
13 START WITH x = req.req
14* CONNECT BY PRIOR x LIKE x || '_'
SQL> /
Enter value for required: 011
old 11: FROM t, (select '&required' as req from dual) req
new 11: FROM t, (select '011' as req from dual) req
X
01
0
SQL> /
Enter value for required: 11
old 11: FROM t, (select '&required' as req from dual) req
new 11: FROM t, (select '11' as req from dual) req
X
1
SQL> -
How to delete all rows data from database
Hello All.
I have a database username 'abc'. This database contain 123 tables & have many data.
I want to empty all the database. Is it possible that clear all the database with a single query.
if yes then kindly tell me about the query .
Thanks
DiamondKeep in mind that you cannot rollback the truncate command.
Once you truncate a table all of it's data AND statistics are gone.
If you do not want to use PL/SQL to delete all rows you can generate a script by SQL
SCOTT@ORCL> SELECT ' TRUNCATE TABLE '|| TABLE_NAME||';' FROM USER_TABLES;
'TRUNCATETABLE'||TABLE_NAME||';'
TRUNCATE TABLE BONUS;
TRUNCATE TABLE SALGRADE;
TRUNCATE TABLE DEPT_LOV;
TRUNCATE TABLE TITLE;
TRUNCATE TABLE TEST_DATE;
TRUNCATE TABLE DEPT;
TRUNCATE TABLE REP;
TRUNCATE TABLE REP_PARAM;
TRUNCATE TABLE EMP;
10 rows selected.
SCOTT@ORCL> SELECT 'DELETE FROM '|| TABLE_NAME||';' FROM USER_TABLES;
'DELETEFROM'||TABLE_NAME||';'
DELETE FROM BONUS;
DELETE FROM SALGRADE;
DELETE FROM DEPT_LOV;
DELETE FROM TITLE;
DELETE FROM TEST_DATE;
DELETE FROM DEPT;
DELETE FROM REP;
DELETE FROM REP_PARAM;
DELETE FROM EMP;
10 rows selected.
SCOTT@ORCL>You can save the output in a .sql file and run it.
Regards,
Tony -
While creating the parameter it doesnot pull all the data of that particular column
Post Author: pvds
CA Forum: Data Connectivity and SQL
Hi everyone.
i am using a sql query with a join condition to pull data in to crystal reports. I got that data which i want in to the report. but when i was trying to create a parameter with a dropdown of all the database values to a particular column it is not showing all the data from the report.
for example i have a column called state
the column has many states displayed in the report but when i select that column and select browse data it shows only 1 state. with this i am anable to create a parameter with a dropdown list of all the state. i can see different states in the report but y i am not able to see when i browse the data or create a parameter? can any one answer me?
i already created another report with a query on same table but i never faced this problem before.Post Author: V361
CA Forum: Data Connectivity and SQL
There is a limit to the number of Parameters that will show in a drop down... You can increase using the following.
Check this KBase article on how to increase the number.
http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2017238&sliceId=&dialogID=19032644&stateId=1%200%2019034607 -
What changes are to be made to sqlplus to show all the data on a single lin
Using Oracle 10.2g
The problem is that whenevr i run queries and collect the data into log and try to take the o/p.
It comes in multiples lines in sqlplus
ex
select* from facts_table;
UPN SID ACYR
================================================== ========== ==========
ID GRADE
========== ==================================================
1140 852 1998
1 E
1140 845 1998
1 D
1140 865 1998
1 D What settings need to be changed so that i can see all the data as
Its a trouble again to modify all the data to be shown properly in the logfile.
UPN SID ACYR ID GRADE
=== === ==== === =====something like this.
Thank you.
Edited by: Trooper on Jan 11, 2009 3:15 AMYou can use
SQL> set lines 150
Anyway You can use column to help if know column length...
Example:
SQL> set lines 100
SQL> column UPN format a15
SQL> column SID format a10
SQL> column ACYR format a15
SQL> column ID format a15
SQL> column GRADE format a5 -
Multiple row data in a single row
I have a table like the following:
AGREEMENT_ID SERVICE_CODE SERIAL_NO
22 CV CE095F0011007884F
22 HS 2509b000121373869
22 NG 2509B000121265554
22 SG 2509B00012120278D
22 SM PAFABM0716140704
22 SN G32X2MI808300348
22 SP CE095F00110045416
22 SV 2509B000121363230
22 SW CE095F00110037377
I would like to have it in the following format
Agreement_id CV HS NG SG SM SN SP SV SW --(These are the columns)
22 CE095F0011007884F 2509b000121373869 2509B000121265554 ....
(This is data)
Need to do it in a single Query....
Want an advice
Regards
Chaitanya.S.S.KHi,
SQL> l
1 with tbl as
2 (select 22 id, 'CV' service, 'CE095F0011007884F' serial from dual
3 union all
4 select 22, 'HS','2509b000121373869' serial from dual
5 union all
6 select 22, 'NG','2509B000121265554' serial from dual
7 union all
8 select 22, 'SG','2509B00012120278D' serial from dual
9 union all
10 select 22, 'SM','PAFABM0716140704' serial from dual
11 union all
12 select 22, 'SN','G32X2MI808300348' serial from dual
13 union all
14 select 22, 'SP','CE095F00110045416' serial from dual
15 union all
16 select 22, 'SV','2509B000121363230' serial from dual
17 union all
18 select 22, 'SW','CE095F00110037377' serial from dual
19 union all
20 select 23, 'SW','CE095F00110037377' serial from dual)
21 select id,
22 max(decode(service,'CV',serial)) "CV",
23 max(decode(service,'HS',serial)) "HS",
24 max(decode(service,'NG',serial)) "NG",
25 max(decode(service,'SG',serial)) "SG",
26 max(decode(service,'SM',serial)) "SM",
27 max(decode(service,'SN',serial)) "SN",
28 max(decode(service,'SP',serial)) "SP",
29 max(decode(service,'SV',serial)) "SV",
30 max(decode(service,'SW',serial)) "SW"
31 from tbl
32* group by id
SQL> /
ID CV HS NG SG SM SN SP SV SW
22 CE095F0011007884F 2509b000121373869 2509B000121265554 2509B00012120278D PAFABM0716140704 G32X2MI808300348 CE095F00110045416 2509B000121363230 CE095F00110037377
23 CE095F00110037377
SQL> HTH,
Nicolas. -
hi all,
In my addon-form i have a matrix,in the matrix i have data for 5 rows....in that 3rd column when i enter any number & press tab key....the remaining 5 rows(downwards only) for that 3rd column only should be get updated with that number...can anybody suggest me some ideas????
example:-
custcode custname days
======= ======= ===
10001 John 3
10002 Peter 8
10003 David 5 -
>here when i type 5 & press tab remining rows for that column should get updated with no:5
10004 Kris
10005 Corter
10006 Albert
regards,
shangai.Hi...
use this code
menu event
If (pVal.MenuUID = "Duplicate") And (pVal.BeforeAction = False) Then
Try
Dim oDBDataSource As SAPbouiCOM.DBDataSource
Dim s As Integer = 0
Dim omat1 As SAPbouiCOM.Matrix
Dim newrowid As Integer = 0
omat1 = RFrm.Items.Item("5").Specific
For s = 1 To omat1.RowCount
If omat1.IsRowSelected(s) Then
Try
omat1.GetLineData(s)
newrowid = s + 1
omat1.AddRow(1, newrowid)
omat1.SetLineData(newrowid)
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
Next
For i = 1 To omat1.RowCount
oedit1 = omat1.Columns.Item("0").Cells.Item(i).Specific
oedit1.Value = i
Next
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
Right Click Event
If eventInfo.FormUID = "Routing" Then
If (eventInfo.BeforeAction = True) Then
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
omat1 = RFrm.Items.Item("5").Specific
GCols = omat1.Columns
Try
selItem = eventInfo.ItemUID
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "Duplicate"
oCreationPackage.String = "Duplicate Row"
oCreationPackage.Enabled = True
oMenuItem = SBO_Application.Menus.Item("1280")
oMenus = oMenuItem.SubMenus
oMenus.AddEx(oCreationPackage)
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
Else
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Try
SBO_Application.Menus.RemoveEx("Duplicate")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End If
It will work...
Regards...
Billa 2007 -
Finding the minimum value across multiple rows (not in a single column)
Hello,
I am running some ad-hoc SQL to test a website implementation of a spec. The ad-hoc sql gives me a set of date values for a specific widget (called a Task). I need to find the Minimum of either (Task.EndDate + 1 year) or the MAX date from the list
of other dates. I can easily get all of these dates, and compare them visually, but I'm not sure how to make SQL give me just the single value that I want. In the image below, you can see the results. The blue cell is the value I should get if I were to retrieve
a single value.
select
[EndDate+12Mo] = DATEADD(year,1,t.EndDate)
, [TaskEdit] = t.EditTS
, [ResearchEdit] = (select x.editts from Research x where t.researchid = x.researchid)
, [DeliverableEdit] = (select max(x.EditTS) from Deliverable x where t.taskid = x.taskid)
, [RTPEdit] = (select max(x.EditTS) from ResTaskParticipant x where (t.taskid = x.taskid and t.researchid = x.researchid) or (t.researchid = x.researchid and x.TaskID is null) )
, [RelatedTaskEdit] = (select max(x.EditTS) from Task_Related x where t.taskid = x.Task1ID or t.TaskID = x.Task2ID)
, [CrosscutEdit] = (select max(x.EditTS) from Task_Crosscut x where t.taskid = x.taskid)
, [TaskFundingEdit]= (select max(x.EditTS) from TaskFunding x where t.taskID = x.taskID)
, [ContractFundingEdit]= (select max(x.EditTS) from TaskFunding x inner join ContractFunding y on x.ContractFundingID = y.ContractFundingID where t.taskID = x.taskID)
from task t
where
t.tasknumber =
'2123.001'
Thanks!
JenniferSounds like this to me
select CASE WHEN [EndDate+12Mo] < MAX(dt) THEN [EndDate+12Mo] ELSE MAX(dt) END AS YourDateValue
from
SELECT [EndDate+12Mo],dt
from
select
[EndDate+12Mo] = DATEADD(year,1,t.EndDate)
, [TaskEdit] = t.EditTS
, [ResearchEdit] = (select x.editts from Research x where t.researchid = x.researchid)
, [DeliverableEdit] = (select max(x.EditTS) from Deliverable x where t.taskid = x.taskid)
, [RTPEdit] = (select max(x.EditTS) from ResTaskParticipant x where (t.taskid = x.taskid and t.researchid = x.researchid) or (t.researchid = x.researchid and x.TaskID is null) )
, [RelatedTaskEdit] = (select max(x.EditTS) from Task_Related x where t.taskid = x.Task1ID or t.TaskID = x.Task2ID)
, [CrosscutEdit] = (select max(x.EditTS) from Task_Crosscut x where t.taskid = x.taskid)
, [TaskFundingEdit]= (select max(x.EditTS) from TaskFunding x where t.taskID = x.taskID)
, [ContractFundingEdit]= (select max(x.EditTS) from TaskFunding x inner JOINContractFunding y on x.ContractFundingID = y.ContractFundingID where t.taskID = x.taskID)
from task t
where
t.tasknumber =
'2123.001'
)t1
UNPIVOT(dt FOR cat IN ([TaskEdit]
, [ResearchEdit]
, [DeliverableEdit]
, [RTPEdit]
, [RelatedTaskEdit]
, [CrosscutEdit]
, [TaskFundingEdit]
, [ContractFundingEdit]))u
)r
GROUP BY [EndDate+12Mo]
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Obiee report two rows data present in single row
Hi Experts,
I have facing one problem how to reslove this problem let me know.
In DB Table like this.
Sno **** Value1 **** Value2
10 ******** 100 ******* 0
10 **** *** 0 ******* 200
i want to out put Obiee reports like this ?????????
sno ***** value1 **** value2
10 ****** 100 **** 200
How to achive this please tell me any method
i am using obiee 10.1.3.4.1 version (i am try to create report OBIEE answers )
Thanks
Satya
Edited by: satya vardhan on Jul 11, 2011 6:56 PMTry going it by Sno.
If you are using Pivot Table, try changing measures from columns to rows and see. I vaguely remember doing this would address your need
Thanks,
Vinag -
Concatenation of row data into a single row
Hi,
I have table which has the data in the following way.
col1 col2 col3
a 1 one
a 2 two
a 3 three
b 1 dfdf
b 2 sfdhh
c 1 zgdhi want data in the following way.
col1 col2 col3
a 1,2,3 one,two,three
b 1,2 dfdf,sfdhh
c 1 zgdhCan any body help me.
Thanks in advancemay be this will work
WITH tab AS
(SELECT 'A' col1,1 col2, 'one' col3 FROM dual
UNION ALL
SELECT 'A' col1,2 col2, 'two' col3 FROM dual
UNION ALL
SELECT 'A' col1,3 col2, 'three' col3 FROM dual
union all
SELECT 'B' col1,1 col2, 'abc' col3 FROM dual
UNION ALL
SELECT 'B' col1,2 col2, 'defg' col3 FROM dual
UNION ALL
SELECT 'C' col1,1 col2, 'hijcol' FROM dual
union all
SELECT 'C' col1,2 col2,'klm' col3 FROM dual
SELECT col1
, ltrim(MAX(SYS_CONNECT_BY_PATH(col2,','))
KEEP (DENSE_RANK LAST ORDER BY curr),',') AS col2,
ltrim(MAX(SYS_CONNECT_BY_PATH(col3,','))
KEEP (DENSE_RANK LAST ORDER BY curr),',')as col3
FROM ( SELECT col1
, col2,col3
, ROW_NUMBER() OVER (PARTITION BY col1 ORDER BY col2) AS curr
, ROW_NUMBER() OVER (PARTITION BY col1 ORDER BY col2) -1 AS prev
FROM tab )
GROUP BY col1
CONNECT BY prev = PRIOR curr AND col1 = PRIOR col1
START WITH curr = 1;
COL1 COL2 COL3
A 1,2,3 one,two,three
B 1,2 abc,defg
C 1,2 hijcol,klm
Maybe you are looking for
-
hi experts, i want to show in VA05 only pending Sales order ! when i m using Open sales order radio butten in VA05 it is showing also comlete sales order. can its possible if yes then How? Anu
-
Unable to burn CDs with music downloaded from iTunes store
It seems that quite a few people have been having problems burning CDs using iTunes 5 and 6, but I'd like to know how many people are experiencing the same problem that I am. iTunes will not burn any of my playlists featuring tracks downloaded from t
-
Hi, I have local PDF file saved on desktop. How to send this file as attacehment in mail.
-
The artworks in my iphone don't match the artworks in itunes
see? what should I do?
-
Problem with Reversed document with IDOC interface
I have a problem when I create Idoc which will reverse a document. I use ACC_DOCUMENT_REVERSE, in Idoc is filled like this - OBJ_TYPE ( BKPFF ) OBJ_KEY( reverse document number + company code + year) OBJ_SYS ( system id ) OBJ_KEY_R ( obj_key of docum