Convert multiple lines in a single line
Hi friends...I have a table with the following information
SQL> select * from tsting;
A B C D E
---------- ---------- ---------- --------- ----------
10
10
10
29-MAY-09
TEST
But I need the following output... A B C D E
---------- ---------- ---------- --------- ----------
10 10 10 29-MAY-09 TEST
Hello
Try:
WITH test_data AS (
SELECT 10 A, NULL B, NULL C, NULL D, NULL E FROM DUAL UNION ALL
SELECT NULL A, 10 B, NULL C, NULL D, NULL E FROM DUAL UNION ALL
SELECT NULL A, NULL B, 10 C, NULL D, NULL E FROM DUAL UNION ALL
SELECT NULL A, NULL B, NULL C, TO_DATE('29-MAY-09','DD-MON-YY') D, NULL E FROM DUAL UNION ALL
SELECT NULL A, NULL B, NULL C, NULL D, 'TEST' E FROM DUAL)
-- end test data
SELECT MAX(A) A, MAX(B) B, MAX(C) C, MAX(D) D, MAX(E) E
FROM test_data;
A B C D E
---------- ---------- ---------- --------- ----
10 10 10 29-MAY-09 TEST
Tags: Database
Similar Questions
-
Convert multiple lines in a single value separated by commas
Is is possible to convert multiple lines in a single value by concatenating the value of each line in OBIEE. I think that IO had seem a blog related to this by I'm not able to find him. Essentially, here's what I would do:
Number of customer location
101
101 NY
101 PA
102 TX
102 CA
This is to convert
101. HE, NY, PA
102 TX, CA
Can you get it someone please let me know if this is possible and how to operate it.
Thanks in advance for the help.You can do this by creating a DB function,
Visit this link
Re: Display of the horizontal valuesThank you
Vino -
Should how Acrobat I buy to be able to convert multiple documents in a single pdf file?
What adobe software, do I need to buy to be able to convert multiple documents in a single PDF file?
Hi Manorani,
The Pack of Adobe PDF allows to combine several files into a single PDF file. For more information, please visit cloud.acrobat.com.
Best,
Sara
-
convert multiple lines into one
Hi all
We got lines with 'yes/no' ' yes/no' for available deposits and appropriations available:
My need is to show only one line for each client_id in a section. For example, client_id = 1 is 'Yes' for credits and deposits ' yes' in the same division, so it must be displayed in a line:select 1 as client_id, 'yes' as credits, 'no' as deposits, 'A' as division_name from dual union all select 1 as client_id, 'no' as credits, 'yes' as deposits, 'A' as division_name from dual union all select 2 as client_id, 'yes' as credits, 'no' as deposits, 'A' as division_name from dual union all select 2 as client_id, 'no' as credits, 'yes' as deposits, 'B' as division_name from dual
How can I make it?select 1 as client_id, 'yes' as credits, 'yes' as deposits, 'A' as division_name from dual union all select 2 as client_id, 'yes' as credits, 'no' as deposits, 'A' as division_name from dual union all select 2 as client_id, 'no' as credits, 'yes' as deposits, 'B' as division_name from dual
SQL> with t as 2 (select 1 as client_id, 'yes' as credits, 'no' as deposits, 'A' as division_name from dual union all 3 select 1 as client_id, 'no' as credits, 'yes' as deposits, 'A' as division_name from dual union all 4 select 2 as client_id, 'yes' as credits, 'no' as deposits, 'A' as division_name from dual union all 5 select 2 as client_id, 'no' as credits, 'yes' as deposits, 'B' as division_name from dual 6 ) 7 select client_id, max(credits) credits, max(deposits) deposites, division_name 8 from t 9 group by client_id, division_name; CLIENT_ID CRE DEP D __________ ___ ___ _ 1 yes yes A 2 yes no A 2 no yes B
?
-
How to convert multiple lines in 1 row of columns across
Hello
My DB 10g
My data as below,
I've already tilt it by84A8E46E9366 20111008133638 84A8E46E9366 20111112000531 84A8E46E9366 20111212004432 84A8E46E9366 20120127173533 84A8E46E9366 20120226235444
and get the result as below with only 2 columnselect msid, rtrim (xmlagg (xmlelement (e, fee || '|')).extract ('//text()'), '|') fee from aaa_bill where msid='84A8E46E9366' and fee is not null group by msid;
but I need the result to be on multiple columns.84A8E46E9366 20111008133638|20111112000531|20111212004432|20120226235444|20120127173533
so I tried the following
but the result, only the first stringselect msid,REGEXP_SUBSTR ( fee , '^[^|]*' ) from ( select msid, rtrim (xmlagg (xmlelement (e, fee || '|')).extract ('//text()'), '|') fee from aaa_bill where msid='84A8E46E9366' and fee is not null group by msid ) ;
84A8E46E9366 20111008133638
is it possible to get Thos on several columns each string on column separated automatically because I have about 20000 msid separateHello
See the FAQ forum: {message identifier: = 9360005}
In Oracle 10, you can do this:
WITH got_c_num AS ( SELECT msid , fee , ROW_NUMBER () OVER ( PARTITION BY msid ORDER BY fee -- or whatever ) AS r_num FROM aaa_bill WHERE ... ) SELECT msid , MIN (CASE WHEN c_num = 1 THEN fee END) AS col_1 , MIN (CASE WHEN c_num = 2 THEN fee END) AS col_2 , MIN (CASE WHEN c_num = 3 THEN fee END) AS col_3 ... , MIN (CASE WHEN c_num = n THEN fee END) AS col_n FROM got_c_num GROUP BY msid ORDER BY msid -- If wanted ;
Note that you must specify the number of columns in the output. If you are unsure, do a high hypothesis. The query works always; unused columns will be NULL.
Published by: Frank Kulash on 12 March 2012 14:45
-
Convert multiple lines in a row
Hello
DB version: 10.2.0.3
It's the entry
NAME Total Free ITEM1 150 50 ITEM2 200 175 Expected result:
Please tell how to get the result in format (SQL using case or nested case) below
(XXX_utilized columns is on Total - free)
ITEM1_TOTAL ITEM1_Utilized ITEM1_Free ITEM2_TOTAL ITEM2_Utilized ITEM2_Free 150 100 50 200 25 175 Kind regards
Veera
with
the entry like
("ITEM1" select name, 150 total, 100 50 used, free of all the double union)
Select 'ITEM2', 200, 25, 175 double
)
SELECT max (case name when total ' ITEM1' then end) item1_total,.
Max (case name when 'ITEM1' then used end) item1_utilized,.
Max (case name when free ' ITEM1' then end) item1_free,.
Max (case name when total ' ITEM2' then end) item2_total,.
Max (case name when 'ITEM2' then used end) item2_utilized,.
Max (case name when free ' ITEM2' then end) item2_free
Since the entry
ITEM1_TOTAL ITEM1_UTILIZED ITEM1_FREE ITEM2_TOTAL ITEM2_UTILIZED ITEM2_FREE 150 100 50 200 25 175 Concerning
Etbin
-
How to convert multiple lines in a row in oracle?
There is output
status st_nm County
AN OPEN 12
A NARROW 13
B OPEN 1
B CLOSE 2
EXPECTED RESULTS
st_nm OPEN_count CLOSE_COUNT
A 12 13
1 2 B
give the possibility of solutions?
Published by: 886380 on September 30, 2011 05:53
Published by: 886380 on September 30, 2011 05:54
Published by: 886380 on September 30, 2011 05:56Hello
This is called a Pivot .
Here's a way to do it:SELECT st_nm , MIN (CASE WHEN status = 'OPEN' THEN cnt END) AS open_count -- COUNT by itself is not a good column name , MIN (CASE WHEN status = 'CLOSE' THEN cnt END) AS close_count FROM existed GROUP BY st_nm;
The best way depends on your exact requirtements and your version of Oracle. (The query above will work in Oracle 8.1 and higher).
For more information, see the FAQ for the forum page:
SQL and PL/SQL FAQ -
How can I convert multiple files into a single PDF?
I need to convert a single file PDF 3 pages of a contract. How can I do this?
Hi millionaire Blackburn.
I checked your account - looks like you have a subscription Pack PDF Adobe, so that's great!
- Sign in to your account at https://cloud.acrobat.com/combinepdf using your Adobe ID and password.
- Click on the selected files to be combined.
- Select the files you want to combine into a single PDF.
- (Optional) Drag the thumbnails of files in the order you want that individual to combine files.
- Click on combine.
Please let us know how it goes!
Best,
Sara
-
Convert a single column into multiple lines
Hi people,
I have a task to display a single column into multiple lines (for use in LOV)
For Ex:
The column consistes of value such as 98,78,67,68,34,90. -It's a unique column values where none of the values can be ' number that is separated by commas
Then we must view it as
98
78
67
68
34
90
-under the number of lines (no lines can be ' do not number).
Thanks in advanceTry this...
SQL> ed Wrote file afiedt.buf 1 select regexp_substr('98,78,67,68,34,90', '[^,]+',1,level) Value 2 from dual 3* connect by level <= regexp_count('98,78,67,68,34,90',',') + 1 SQL> / VALUE ----------------- 98 78 67 68 34 90 6 rows selected.
Thank you!
-
How to insert multiple lines using a single query
Hi all
How to insert multiple lines using a single query to the emp table?
I have the number of rows to insert into table x. consumes a lot of time. I tried to insert several lines using a single query, but get errors. I know exactly the query to do this.
Thank you
SunilLike this?
SQL> create table test(id number , dt date); Table created. SQL> insert into test values(&a,&b); Enter value for a: 1 --- It asked me and I entered 1 Enter value for b: sysdate --- It asked me and I entered sysdate old 1: insert into test values(&a,&b) new 1: insert into test values(1,sysdate) 1 row created. SQL>
g.
-
Data in multiple lines concatenated into a single line to separate id
Hello
I have a t1 like this table:
create table t1
(number of c1,
number of C2,
C3 number (4.2)
);
Data in the table are such as:
----------------------------------------
C1 | C2 | C3 |
-----------------------------------------
102. 1. 1.1 |
102. 1. 1.2 |
102. 2. 2.1 |
103. 2. 2.1 |
103. 2. 2.2 |
-----------------------------------------
How to display data by using a query above?
------------------------------------------------------
C1 | C2 | C3 |
-------------------------------------------------------
102. 1, 2 | 1.1, 1.2, 2.1 |
103. 2. 2.1, 2.2.
------------------------------------------------------
Thank youSo you're after what we call 'Aggregation in the chain.'
Check this link as it highlights several techniques:
Aggregation of string techniques
A Re: Concat ranks of the values in a single column Michael
At Re: multiple lines in a single line in the 'single column Table' followed by reason of Billy on the conduct of a stragg first.
In addition, 11 GR 2 has the LISTAGG function.
-
Arrange the tiles in a column, but multiple lines
When you have the tiles on The start screen of Metro , you can set the group / block a tile only, but when you want to add the second tile to this group / block, you can put only horizontally (from left or right tile existed), in other words, you can add the column within that group, but you can put the new Tile vertically , under a tile already existence.
I want to define group / block of tiles with a single column, but multiple lines.For example, instead of this:xx xx xx xxxx xx xxto get this:xx x xx xxxx x xx xxScreenshot:Hi Mike b. II.
It's normal. You cannot have tiles in groups vertically. Now in your case, if you change the tiles to large tiles, they will stack vertically.
-
Combine multiple lines into one line (from two tables / result sets)
Hello experts,
I would like to know how to combine multiple lines/records in a single record. Here are the DDL and DML to tables:
create table test_table)
client_name varchar2 (50 char),
login_time timestamp (6).
logout_time timestamp (6).
auto_type varchar2 (10 char)
)
create table root_table)
navigation_time timestamp (6).
client_name varchar2 (50 char),
VARCHAR2 (50 char) nom_du_groupe
)
Insert into test_table
values ("John", TO_TIMESTAMP ('2013-12-05 17:04:01.512 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), TO_TIMESTAMP ('2013-12-05 17:27:31.308 ',' YYYY-MM-DD HH24:MI:SS.) FF'), 'SIMPLE');
Insert into test_table
values ('David', TO_TIMESTAMP ('2013-12-05 06:33:01.308 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), TO_TIMESTAMP ('2013-12-05 06:45:01.112 ',' YYYY-MM-DD HH24:MI:SS.) FF'), 'SIMPLE');
insert into root_table
values (TO_TIMESTAMP ('2013-12-05 17:04:01.512 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'John', "invalid");
insert into root_table
values (TO_TIMESTAMP ('2013-12-05 17:14:22.333 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'John', "GROUP_1");
insert into root_table
values (TO_TIMESTAMP ('2013-12-05 17:27:31.308 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'John', "GROUP_1");
insert into root_table
values (TO_TIMESTAMP ('2013-12-05 06:33:01.308 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), "David", "invalid");
insert into root_table
values (TO_TIMESTAMP ('2013-12-05 06:45:01.112 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'David', 'GROUP_5');
game results test_table
client_name login_time logout_time auto_type John 05/12/2013 5:04:01.512000 PM 05/12/2013 5:27:31.308000 PM SIMPLE David 05/12/2013 6:33:01.308000 AM 05/12/2013 6:45:01.112000 AM SIMPLE root_table result set
navigation_time client_name GroupName 05/12/2013 5:04:01.512000 PM John Not valid 05/12/2013 5:14:22.333000 PM John GROUP_1 05/12/2013 5:27:31.308000 PM John GROUP_1 05/12/2013 6:33:01.308000 AM David Not valid 05/12/2013 6:45:01.112000 AM David GROUP_5 And here is the SQL code I'm writing:
Select a.customer_name, a.login_time, a.logout_time, a.auto_type, Max (b.group_name)
from test_table a, b root_table
where a.customer_name = b.customer_name
Group of a.customer_name, a.login_time, a.logout_time, a.auto_type
As the 'invalid' value is greater than the value "GROUP_1" (based on the number of letter in English), the GroupName is returned as 'invalid '. I want to bring the GroupName based on the navigation_time column in the root_table so that it always returns a valid GroupName. Please help me.
Output current:
Client_name. Login_Time. Logout_Time | Auto_Type | GroupName
--------------------------------------------------------------------------------------------------------------------------------------------
John | 05/12/2013 5:04:01.512000 PM | 05/12/2013 5:27:31.308000 PM | SIMPLE | Not valid
David | 05/12/2013 6:33:01.308000 AM | 05/12/2013 6:45:01.112000 AM | SIMPLE | Not valid
Expected results:
Client_name. Login_Time. Logout_Time | Auto_Type | GroupName
--------------------------------------------------------------------------------------------------------------------------------------------
John | 05/12/2013 5:04:01.512000 PM | 05/12/2013 5:27:31.308000 PM | SIMPLE | GROUP_1
David | 05/12/2013 6:33:01.308000 AM | 05/12/2013 6:45:01.112000 AM | SIMPLE | GROUP_5
Thank you!
Adding INSERT statements, current and planned outputs.
This...
SELECT client_name
login_time,
logout_time,
auto_type,
GroupName
Of
(select a.customer_name,
a.login_time,
a.logout_time,
a.auto_type,
b.group_name,
ROW_NUMBER() over (PARTITION BY a.customer_name, a.login_time, a.logout_time, a.auto_type ORDER BY b.group_name) rn
from test_table a, b root_table
where a.customer_name = b.customer_name)
WHERE rn = 1;
OUTPUT:-
=========
David DECEMBER 5, 13 06.33.01.308000000 AM DECEMBER 5, 13 06.45.01.112000000 AM SIMPLE GROUP_5 John DECEMBER 5, 13 05.04.01.512000000 PM DECEMBER 5, 13 05.27.31.308000000 PM SIMPLE GROUP_1 Thank you
Ann
-
Frame content with multiple lines of text
Hello
In Indesign CS5 (Mac) is possible to get the same behavior as 'To adapt to the content Frame' pieces on a single line of text, to work with multiple lines?
In other words, to adapt the framework to the height AND width of the text.
We have black text and the text block has a fill and a stroke. What we are trying to achieve is to be able to quickly and accurately, resize it framework for however many lines it takes place in. By using the default behavior, so that we can use "mount the frame to the content" to get the height, but we need to manually drag the width.
Thank you
Try this (CS4/CS5):
// Your Settings: var X_PRECISION = .1; // pts // Some constants var INNER = CoordinateSpaces.INNER_COORDINATES, MULTIPLY = ResizeMethods.MULTIPLYING_CURRENT_DIMENSIONS_BY, ADDTO = ResizeMethods.ADDING_CURRENT_DIMENSIONS_TO, AP_LEFT = AnchorPoint.TOP_LEFT_ANCHOR, AP_RIGHT = AnchorPoint.TOP_RIGHT_ANCHOR; function fitHorizontal(/*TextFrame*/ tf, /*str*/xRef) //---------------------------------------------------------- // Fits a textframe width to its content // = adjusts the frame width to the optimal value without changing the height // xRef (opt.) is the reference pt: 'left'(default) | 'right' | 'center' // * You may invoke first tf.fit(FitOptions.FRAME_TO_CONTENT), i.e. fitVertical // * This routine supports rotated text frame // * Also, unlike the InDesign UI, this supports *multicolumn* TF //---------------------------------------------------------- { // Default width multiplier. This value is only used if // tf overflows in its initial state. 1.5 is fine, usually. var X_FACTOR = 1.5; var ovf = tf.overflows, dx; xRef = AnchorPoint['TOP_'+(xRef||'left').toUpperCase()+'_ANCHOR']; // If tf originally overflows, we need to increase the width while( tf.overflows ) tf.resize(INNER,xRef,MULTIPLY,[X_FACTOR,1]); // Now, let's compute the maximal width variation (dx) dx = tf.resolve(AP_RIGHT, INNER)[0][0]-tf.resolve(AP_LEFT, INNER)[0][0]; if( ovf ) dx *= (1-1/X_FACTOR); // Dichotomy on dx while( dx > X_PRECISION ) { dx*=.5; tf.resize(INNER,xRef,ADDTO,[dx*(tf.overflows?1:-1),0]); } // Last step, if needed if( tf.overflows ) tf.resize(INNER,xRef,ADDTO,[dx,0]); } //---------------------------------------------------------- // Sample code //---------------------------------------------------------- // Assuming the user has selected a text frame var tf = app.selection[0]; // Vertical fit (if you want it first --but not needed) tf.fit(FitOptions.FRAME_TO_CONTENT); // Horizontal fit (from the left edge) fitHorizontal(tf, 'left');
@+
Marc
-
multiple lines of text on a command button
Is it possible to get multiple lines of text on a command button. Instead of a large button with the text "start the Test System". I would like a big button with 3 lines.
Beginning
Test
System
If you change the label of the button control in IUR editor you can split the text into lines with Ctrl + Enter.
If you programmatically set the label, "\n" code integration in the text of the label.
Both methods work for all types of control, not only for the command buttons.
Maybe you are looking for
-
614 GB used on Flash, but I only have 120 GB?
Hello. I have a very big problem: my Flash storage is full. Now, it shows me, that I have still free 10 Gigabyte. BUT it also shows me that my Apps use Gigabyte 614 I have a few games: Minecraft, League of Legends, Trine 2 and The Secret of Monkey Is
-
How to replace battery Satellite Pro 4310
Hi all I would like to know how to replace the battery on my old of Satellite Pro 4310, I read it in my paper user. We're supposed to a locking system, but I have not found anything close to the battery... only a drawing with two positions lock and u
-
I am the normal way through properties ok not change thank you for an answer in french please
-
Cannot load images JPEG XR (.jxr). Error #2124
Hello I do an app for iOS and Playbook that async target images JPEG XR (.jxr) (with loads ( flash.display.Loader). On iOS works perfectly fine, but when I deploy it on the Playbook, I get the message "Error #2124". I have my app.xml: And I put on my
-
How to select and change the LabelFields / ButtonFields table 2D
Hi everyone, I'm new here and I'm new to the blackberry development. For a project student I'm working, I have a table 2D-ButtonFields, (I can change LabelFields if it's easier) which I use to create a Sudoku grid. I understand that this is really ba