Merging two columns
Hi All,
I have 1 tables. Scripts and some values are given below.
create table T1(s_id varchar2(30), rs_id varchar2(30));
insert into T1(s_id,rs_id ) values (s1,rs1 );
insert into T1(s_id,rs_id ) values (s1,rs2 );
insert into T1(s_id,rs_id ) values (s1,rs3 );
insert into T1(s_id,rs_id ) values (s1,rs4 );
The value s1 will be repeated for all of the rs_id value.
I want to make the output like :
s1
rs1
rs2
rs3
rs4
Can any body tell me how to proceed without using union or union all, may be by using Analytic function using single SQL statement.
This?
SQL> select decode(row_number() over(partition by s_id order by null),1,s_id,null) s_id,rs_id
2 from t1;
S_ID RS_ID
s1 rs1
rs4
rs3
rs2
Similar Messages
-
Display TextBox Merging two columns
hi
In a Form i want to display textbox merging two columns
when i increading the width of textbox , elements(textbox,selectlist) in the column 2 move right sideEdit your item and go to
Displayed > ColSpan
and increase it to two or three...
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Merging two columns with muliple rows in Numbers '09
I am trying to merge two columns each with 100 rows and related data. Column one is the street address and column two have office numbers. The final result would be one column with 100 rows with address and office numbers.
Ed Carreonsanpanza wrote:
I am trying to merge two columns each with 100 rows and related data. Column one is the street address and column two have office numbers. The final result would be one column with 100 rows with address and office numbers.
Ed Carreon
Hi Ed,
Use the CONCATENATE() function.
Street address in column D, Office number in Column E
100 Smith ST 212
Formula: =CONCATENATE(E," ",D)
Result:
212 100 Smith ST
Note the formula has three arguments, the reference to column E, a text literal (" ") containing a single space, and a reference to column D.
Regards,
Barry -
How to merge two columns in WAD(column chart)
Dear Experts,
Please provide your valuable suggestion to get a merge two columns in one column WAD column chart.
Example: we are having 3 fields (Budgeted value, Actual budgeted value & non budgeted value).
In the chart to be shown, budgeted value in one column, remaining two to be merged in one column
In below sample image Actual(Volume) column is having twe fields (Budgeted SKU value & Non budgeted SKU),
please provide solution to get same in SAP BI/BW WAD.
Thanks & Regards,
Sudarsan Reddy.Hi..,
With in the internal table structure you can declare one more field like NAME(30).
And concate nate first name and last name into that NAME field of internal table and modify the internal table
Now display this field..
Thanks,
Naveen.I -
How to merge two columns in csv file using vbscript?
How i can merge two column in csv file using vbscript or powershell?
1 , 2 , 3 , 4 , 5
1 , 23 , 4 , 5
thanksHere are two examples
http://msdn.microsoft.com/en-us/library/ms191250.aspx
calulated
http://msdn.microsoft.com/en-us/library/ms191250.aspx
Gary Newman MCSE, MCT, CCNA, MCSD, MCPD, MCDBA, MCAD, MCSA, MCTS Developer and Administrator On SharePoint 2013 SharePoint Practice Manager for AmeriTeach Denver, CO. -
Hi Experts,
I have a requirement, and I need to merge the the two columns in ALV. How can I do this?
Points will be rewarded for helpful answers.
Thanks in advance...Hi Salem
Check this sample code
LOOP AT itab.
CONCATENATE itab-amount itab-currency INTO itab-combined.
MODIFY itab.
ENDLOOP.
You will probably need to embellish just that concat command as all fields will be treated as TYPE C.
Then inhibit the display of the original fields amount and currency by setting NO_OUT=X in the fieldcat loop (or other method).
There may be a FM to merge/format amounts and currency but I couldnt find one on quick search.
The option 'USING EDIT MASK' from WRITE command is also available in ALV structure IT_FIELDCAT.
I have only used it in write and for simple stuff, but it may have some options for you.
Check '==conv' for output conversion routine...
Reward all helpfull answers
Regards
Pavan -
Merge two column value in single column
Team,
I have a requirement where in I need to merge 2 column values in a single column.
ex. I have Percent_complete column in my table. and my table has only one record.
I need to query such that I need to store the values of percent_complete and (100- percent_complete) values in a single column.
ex
Percent complete has 30 value.
I need to select 30 and 70(100-30) both in a single column.
Thanks,SQL> select *
2 from tbl
3 /
PERCENT_COMPLETE
30
SQL> select abs(grouping(1) * 100 - max(percent_complete)) percent_complete
2 from tbl
3 group by rollup(1)
4 /
PERCENT_COMPLETE
30
70
SQL> select nvl(percent_complete,100 - max(percent_complete)) percent_complete
2 from tbl
3 group by rollup(percent_complete)
4 /
PERCENT_COMPLETE
30
70
SQL>
SY. -
Merge Two Columns in a Single Column
Dear,
Inputs
Table1 |
Col1 (Number) |
1 |
2 |
3 |
4 |
5 |
6 |
and table 2
Table2 |
Col1 (Number) |
7 |
8 |
9 |
10 |
11 |
12 |
No relation between the two tables
I want to write a select statement that will result
Column
1
2
3
4
5
6
7
8
9
10
11
12
No sorting is required, I just need to have all the values listed in a single column... How can I do?
Thanks in Advance.If there is dup values between the two tables and you want get only unique, use UNION. If not UNION ALL as already stated.
Nicolas. -
Merge two columns of url/text and locator numbers
Want to merge a url - http://www.vimeo.com to a numbered vimeo film locator for the 'screeners sheet' for a film contest.
The current set up is: Column A - film title; Column B will be the Category; Column C - the url of vimeo with a / at the end to accept...Column D - the vimeo film locator number; Columns E-I will be the rating topics (originality, technical accuracy etc); Column J will contain the sum of the screeners ratings from Columns E-I.
There is no need to have totals at the bottom of columns just at the end of the rows. We have about 1000 films being rated for the Contest to win over $30k in Awards (sweet!). Ultimately this list will be divided into Categories then 'shared' with the individual screening teams to view remotely through this spread sheet and rate the film work.
Oh the coup de gras is the merge needs to keep it as an active link to Vimeo (which doesn't happen in the =Concatenate(C,D) formula. The lyper link stays active when we manually input each letter/number - but for 1,000 films - that's a yikes amount of work. Gotta be an easier way!
Thanks for your help!
Possible Futures Film Contest
Programming Team
May 29Might need the mystics as well!
I'm having difficulty getting Numbers to recognize URLs to begin with, not just when they've been put together with the concatenation function (or the concatenation operator). I do have the feature turned on, but the recognition has been sporadic, to say the least.
Assuming you have that sorted out, this might be a profitable line of enquiry:
After joining the items using concatenation, select the cells now containing the full URL and Copy, then go to the Edit menu and choose Paste Values.
Can't test it myself, for the reasons given above, but the labor cost of the home test isn't unendurable.
Regards,
Barry -
hi i queried on my database as follow,
<pre>
SELECT
C.LKP_ID ID,D.LKP_ID AS ID,C.ROOT_CAUSE_CODE AS CODE,D.PART_DISPOSTN_DESC AS CODE
FROM
SELECT DISTINCT
A.LKP_ID AS LKP_ID
,D.PART_CNDTN_CD as ROOT_CAUSE_CODE
,C.LKP_NM as ROOT_CAUSE_DESC
,A.CREATED_DT AS OD_CREATED_DATE
,A.UPDATED_DT AS OD_LAST_UPDATED_DATE
,CURRENT_TIMESTAMP AS CREATED_DATE
,CURRENT_TIMESTAMP AS LAST_UPDATED_DATE
FROM FWOWNER.CLM_LKP_VALUE A, FWOWNER.CLM_LKP_USAGE B , FWOWNER.CLM_LKP_VALUE_LANG C,
IWOWNER.WC_CLM_SRVC_PART D
WHERE B.LKP_USED_AS IN ('RR_CAUSAL_PART_CNDTN_CODE')
AND A.LKP_REF BETWEEN B.LKP_REF
AND B.LKP_REF + '.99999' and A.LKP_ID = C.LKP_ID
AND C.LANG_CD = 'ENG_USA'
AND A.LKP_LVL = 3
and D.PART_CNDTN_CD = A.LKP_VALUE
)C
CROSS JOIN
SELECT DISTINCT
A.LKP_ID AS LKP_ID
,D.PART_DISPOSTN_CD as PART_DISPOSTN_CODE
,C.LKP_NM as PART_DISPOSTN_DESC
,A.CREATED_DT AS OD_CREATED_DATE
,A.UPDATED_DT AS OD_LAST_UPDATED_DATE
,CURRENT_TIMESTAMP AS CREATED_DATE
,CURRENT_TIMESTAMP AS LAST_UPDATED_DATE
FROM FWOWNER.CLM_LKP_VALUE A, FWOWNER.CLM_LKP_USAGE B , FWOWNER.CLM_LKP_VALUE_LANG C,
IWOWNER.WC_CLM_SRVC_PART D
WHERE B.LKP_USED_AS IN ('rr_parts_disposition')
AND A.LKP_REF BETWEEN B.LKP_REF
AND B.LKP_REF + '.99999' and A.LKP_ID = C.LKP_ID
AND C.LANG_CD = 'ENG_USA'
AND A.LKP_LVL = 3
and D.PART_DISPOSTN_CD = A.LKP_VALUE
)D
</pre>
which resulted with :
<pre>
ID ID CODE CODE
25768 28225 CP01 OVERHAULED
25771 28225 CP04 OVERHAULED
25774 28225 CP07 OVERHAULED
25777 28225 CP10 OVERHAULED
25778 28225 CP11 OVERHAULED
25779 28225 CP12 OVERHAULED
25780 28225 CP13 OVERHAULED
25781 28225 CP14 OVERHAULED
25783 28225 CP16 OVERHAULED
25785 28225 CP18 OVERHAULED
25786 28225 CP19 OVERHAULED
25788 28225 CP21 OVERHAULED
25789 28225 CP22 OVERHAULED
25790 28225 CP23 OVERHAULED
25793 28225 CP26 OVERHAULED
25795 28225 CP28 OVERHAULED
25796 28225 CP29 OVERHAULED
25797 28225 CP30 OVERHAULED
25798 28225 CP31 OVERHAULED
25799 28225 CP32 OVERHAULED
20 record(s) selected [Fetch MetaData: 0/ms] [Fetch Data: 0/ms]
</pre>
i need to Merge both ID's and Code which may yield 21 records, how to do this, please help me
Regards
Naren.Hi, Naren,
Whenever you have a problem, it helps if you pst a little sample data (CREATE TABLE and INSERT statements, elevenat columns only) and the results you want from that data.
I suspect you want to do something like this:
SELECT A.LKP_ID AS ID
, D.PART_CNDTN_CD as CODE
FROM FWOWNER.CLM_LKP_VALUE A
, FWOWNER.CLM_LKP_USAGE B
, FWOWNER.CLM_LKP_VALUE_LANG C
, IWOWNER.WC_CLM_SRVC_PART D
WHERE B.LKP_USED_AS IN ( 'RR_CAUSAL_PART_CNDTN_CODE'
, 'rr_parts_disposition'
AND A.LKP_REF BETWEEN B.LKP_REF
AND B.LKP_REF + .99999 -- No quotes
and A.LKP_ID = C.LKP_ID
AND C.LANG_CD = 'ENG_USA'
AND A.LKP_LVL = 3
and A.LKP_VALUE = CASE
WHEN B.LKP_USED_AS IN ( 'RR_CAUSAL_PART_CNDTN_CODE')
THEN D.PART_CNDTN_CD
WHEN B.LKP_USED_AS IN ('rr_parts_disposition')
THEN D.PART_DISPOSTN_CD
END
;or maybe a UNION instead of a join.
Edited by: Frank Kulash on Feb 9, 2010 9:08 AM
Revised last condition. -
Merge Two Rows of a table to One row but into two columns
Hi
I Am struck in writing a query to merge two rows into two columns of one row.
Here is the Sample data i am working with,
Col 1 Col 2 Col3 Col4 Col Col6
5000 573-3000 2 0 Phone
5000 573-3036 1 0 Fax
5000 893-5703 3 0 WOrk
3000 232-5656 1 0 Phone
3000 353-5656 2 0 FAx
Here Col,Col3,Col4 form the Key.
now wht i am trying to do is to Merge these type of rows put them into Columns P,F,W,E respectively to achive a Structure as below
Col1 P F W
5000 573-3000 573-3036 893-5703
3000 232-5656 353-5656
Can you please help me how could i do this.
I am pretty ordinary at writing SQL's.
Thanks a Lot in Advance
Message was edited by:
SreebhushanSearch the forum for PIVOT and you'll find plenty of examples.
-
How to CREATE VIEW to merge two tables each of which has CLOB-typed column
I failed in creating a view to merge two tables that have CLOB-type column each.
The details are:
Database: Oracle 9i (9.2.0)
Two tables "test" and "test_bak", each of which has the following structure:
ID Number(10, 0)
DUMMY VARCHAR2(20)
DUMMYCLOB CLOB
The following operation fails:
create view dummyview (id, dummy, dummyclob) as
select id, dummy, dummyclob from test
union
select id, dummy, dummyclob from test_bak;
I was announced:
select test.id, test.dummy, test.dummyclob
ERROR in line 2:
ORA-00932: inconsistent data type: required - , but CLOB presented.
But if creating views from only ONE table with CLOB-type columns, or from two tables WITHOUT CLOB-typed columns, the creation will succeed. The following 1) and 2) will succeed, both:
1) one table, with CLOB-typed column
create view dummyview (id, dummy, dummyclob) as
select id, dummy, dummyclob from test;
2) two tables, without CLOB-typed columns
create view dummyview (id, dummy) as
select id, dummy from test
union
select id, dummy from test_bak;
I want to merge the two tables all, with complete columns, how to write the CREATE VIEW SQL statement?
many thanks in advanceDong Wenyu,
No.
But you could do this:
SELECT source.*, nvl (tab1.clob_column, tab2.clob_column)
FROM your_table1 tab1, your_table2 tab2, (
SELECT primary_key, ...
FROM your_table1
UNION
SELECT primary_key, ...
FROM your_table2
) source
WHERE source.primary_key = tab1.id (+)
AND source.primary_key = tab2.id (+)
In other words, do the set operation (UNION (ALL)/INTERSECT/MINUS) on just the PK columns before pulling in the LOB columns.
d. -
Hello all,
We have a requirement that we need to combine data from two columns. We have comments1 field in TABLE A and comments2 and comments3 fields in a TABLE B. The the report has a condition:
Begin
If status = 'Pre-Award' then
Print comments1 from TABLE A;
ELSIF
status = 'Post-Award' then
Print comments2 and comments3 from TABLE B;
END IF
END
Tools version: Oracle reports version 6i.
Thanks in advance.
Arun.There's a couple of ways to do this.
One way would be to create a placeholder column for your comments.
The create a function (much like what you have already listed) to determine which comments to use and place the value of that comment into your placeholder column. You can then use it in that group just as you would any other field.
Chad -
Creating a two columns text reflow
Hi
I'm trying to create a two column page which needs to get data that will fill the columns. Upon filling one column, the text will need to reflow to the next one (as much as a two column text frame in a layout program does).
Is it possible in a Designer ES? (version 8.2.1.5161.1.566259) What is the best practice to do so?
Thanks,
Yossi MaozAre you trying to make it an interactive form or are you going to merge data onto the template and make a print form? In either case I modified your sample. The root Page subform must be set to flowed. You do not need a field in the second content area. I resized the 1st field to make it easier. I changed the layout to allow the field to expand in the Y direction (on the layout tab). I cahnged the Form Properties/Preview to Interactive so that I coudl enter in data. Now when the field fills up scroll bars will appear and when you tab off of the field the field will be redrawn to its actual size. Enter in enough data to case a page overflow and you will see the second column fill up.
Paul -
[JS CS3] Merging table columns
Hi all,
What's the fastest way to merge columns in a table?
I'm using the following loop to merge the 4th and 5th columns in my table:
for( var f = myTable.rows.length-1; f >= 0; f-- ){
myTable.columns[3].cells[f].merge (myTable.columns[4].cells[f])
It works, but I'm working on a large table (120 pages worth) and have many instance where I need to merge columns. Using the loop above, the script takes hours to run. Is there a faster way to merge columns while keeping the rows intact?
Thanks,
MichaelI've just done some time testing with CS4 and found the following:
table = app.documents[0].stories[0].tables[0];
start = new Date();
for (var n = 0; 100 > n; n++) {
cells = table.cells;
for (var j = 0; cells.length > j; j++) {
cells[j].contents = "James";
end = new Date();
alert(end - start);
takes just about the same time to run as:
table = app.documents[0].stories[0].tables[0];
start = new Date();
rowCount = table.rows.length;
columnCount = table.columns.length;
for (var n = 0; 100 > n; n++) {
for (var c = 0; columnCount > c; c++) {
for (var r = 0; rowCount > r; r++) {
table.cells.item(c + ":" + r).contents = "Harry";
end = new Date();
alert(end - start);
While this version takes about half as long again:
table = app.documents[0].stories[0].tables[0];
start = new Date();
rowCount = table.rows.length;
columnCount = table.columns.length;
for (var n = 0; 100 > n; n++) {
for (var c = 0; columnCount > c; c++) {
for (var r = 0; rowCount > r; r++) {
table.rows[r].cells[c].contents = "Harry";
end = new Date();
alert(end - start);
None of which is particularly surprising. But when I compared the following two scripts, I was astonished by the result:
table = app.documents[0].stories[0].tables[0];
start = new Date();
rowCount = table.rows.length;
columnCount = table.columns.length;
for (var n = 0; 100 > n; n++) {
table.cells.everyItem().contents = "Harry";
end = new Date();
alert(end - start);
table = app.documents[0].stories[0].tables[0];
start = new Date();
rowCount = table.rows.length;
columnCount = table.columns.length;
for (var n = 0; 100 > n; n++) {
table.cells.itemByRange(0, -1).contents = "George";
end = new Date();
alert(end - start);
The latter, using itemByRange was about a third faster than using everyItem(). 1800 milliseconds to 2700 on a 4 x 10 table.
Dave
Maybe you are looking for
-
Date criteria in Crystal Reports
SELECT A.EMPLID, C.NAME, A.SHEET_ID, A.SHEET_NAME, TO_CHAR(A.ACCOUNTING_DT,'YYYY-MM-DD'), A.POST_STATUS_EX, A.BUSINESS_UNIT_GL, TO_CHAR(B.TRANS_DT,'YYYY-MM-DD'), B.EXPENSE_TYPE, B.MERCHANT, B.DESCR254, B.TXN_AMOUNT FROM PS_EX_SHEET_HDR A, PS_EX_SHEET
-
How to remove an arc correctly?
Can someone explain how to remove an ARC relation correctly? Deleted the arc in the logical model but when I do an "engineer to relational model" the ARC is not removed there.
-
IE script error rendering DataSet. JSP
IE console catches the error as: SCRIPT600: Unknown runtime error SpryData.js, line 1269 character 4 The dataset is to be displayed in a table. IE displays the table, but instead of data, it displays each <td> as {dataSetName::columnName}
-
How to delete request in BI 7.0
Hi, How to delete successful load request in BI 7.0 ( Like in BW 3.5 We can forcibely make to red and we delete request) in the same way can we delete the request? If not how to delete reuqest please tell me ASAP.
-
My document is deleted on IPhone how I can find him ?
My document is deleted on IPhone how I can find him ?