Show Column Data In One Row
Hello,
Tell Me how i can show a single column data in one row.
10
20
30
To
10,20,30
If you are OK with displaying comma separated list or column data you could:
SQL> select ltrim(sys_connect_by_path(ename,','),',') ename_list
2 from (
3 select ename,
4 row_number() over(order by 1) rn,
5 count(*) over() cnt
6 from emp
7 )
8 where rn = cnt
9 start with rn = 1
10 connect by rn = prior rn + 1
11 /
ENAME_LIST
SMITH,ALLEN,WARD,JONES,MARTIN,BLAKE,MILLER,SCOTT,KING,TURNER,ADAMS,JAMES,FORD,CLARK
SQL> To display as separate columns you would need to either know number of rows:
SQL> select min(case rn when 1 then ename else null end) ename1,
2 min(case rn when 2 then ename else null end) ename2,
3 min(case rn when 3 then ename else null end) ename3,
4 min(case rn when 4 then ename else null end) ename4,
5 min(case rn when 5 then ename else null end) ename5,
6 min(case rn when 6 then ename else null end) ename6,
7 min(case rn when 7 then ename else null end) ename7,
8 min(case rn when 8 then ename else null end) ename8,
9 min(case rn when 9 then ename else null end) ename9,
10 min(case rn when 10 then ename else null end) ename10,
11 min(case rn when 11 then ename else null end) ename11,
12 min(case rn when 12 then ename else null end) ename12
13 from (
14 select ename,
15 rownum rn
16 from emp
17 )
18 /
ENAME1 ENAME2 ENAME3 ENAME4 ENAME5 ENAME6 ENAME7 ENAME8 ENAME9 ENAME10 ENAME11 ENAME12
SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS JAMES
SQL> or use dynamic SQL.
SY.
Similar Messages
-
How to display Column data in one row
Hello,
I have one Employee with 4 effective date displayed in one column. Effective date is drived by Reason of : New Hire, Rehire, Transfer etc.
I want to show the effective dates for one reason in one single row. For example a person was rehired 4 times it will show as
1006555 6/12/2006 1/2/2007 6/11/2007 5/12/2008 12/29/2008 5/17/2010
It's currntly showing as:
AUDITEFFECTIVEDATE_3
6/12/2006
1/2/2007
6/11/2007
5/12/2008
5/17/2010Well that's a little tougher... For a solution to work, you're going to need to find a way to differentiate between the the specific hiring events. Without seeing what data is available, I'd say start looking at the use of running totals... or in this case a running count.
Set it up to reset on EmployeeID and count each "event", incrimenting up with each instance.
Then your formula would look more like this...
IF {EventType} = "Rehire" AND {#RTotal1} = 1 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 1 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Rehire" AND {#RTotal1} = 2 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 2 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Rehire" AND {#RTotal1} = 3 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 3 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Rehire" AND {#RTotal1} = 4 THEN AUDITEFFECTIVEDATE_3
IF {EventType} = "Exit" AND {#RTotal1} = 4 THEN AUDITEFFECTIVEDATE_3
This issue then becomes an issue of space on the report. You end up wasting 1/2 of your horizontal space trying to allot for one odd ball... You'll also get to re-work the report if the same employee goes for rounds 5, 6 or 7...
HTH,
Jason -
Need to split data from one row into a new row redux
Hi folks,
I asked this question about eight months ago (see thread https://discussions.apple.com/message/23961353#23961353) and got an excellent response from forum regular Wayne Contello. However, I need to perform this operation again and when I attempted it recently, I am now greeted with a yellow warning triangle. Clicking it shows "This formula can’t reference its own cell, or depend on another formula that references this cell."
What I'm trying to do is the following:
I have an excel file that keeps track of members of a social group. The file places each member "unit" on a single row. The unit can be a single person or a couple. Columns are labeled "First1" "Last1" "Hometown1" "B-day1" while the second member of the unit is identified in columns like "First2" "Last2" etc.
What I'd like to do is duplicate those rows with two people (which I'll do by hand) but have a way of deleting the "xxxx2" data from one row and the "xxxx1" data from the duplicate row.
Wayne's illustrated solution was to create a blank sheet and enter the following formula in cell A2:
=OFFSET(Input Data::$A$2, INT((ROW()−2)÷2), COLUMN()−1+IF(MOD(ROW()−2, 2)=0, 0, 4)), which apparently worked fine for me last year but now is sending up an error flag. When I look at the formula, there is no clue except that which I quoted above.
Can anyone (or hopefully Wayne) take a second look at this and help me out? I can't imagine that it's a problem with using the newer version of Numbers, but who knows? I'm using version 3.2 (1861), which is the "new" Numbers.
Any help would really be appreciated.
Thanks!
-TodHi Tod,
The error message "This formula can’t reference its own cell, or depend on another formula that references this cell." may be because your table may be different from the one you were using for Wayne's solution. Numbers has Header Rows, Footer Rows and Header Columns. Such Headers in tables exclude themselves from formulas. Excel does not recognise them as headers. What table are you using now?
A screen shot of (the top left portion of) your table or a description of what you see under Menu > Table will help.
Regards,
Ian. -
Hello ---
I have an array of data, I would like to be displayed all the data in one row.<tr></tr>, how to do this?
If I use <h:table> <column></column></h:table>, it will display different rows.
Thanks!
BenPopulate the components in the backingbean. Try something like:
JSF<h:panelGrid binding="#{myBean.grid}" />MyBeanprivate List arrayOfData;
private HtmlPanelGrid grid; // + getter + setter
private void populateGrid() {
grid = new HtmlPanelGrid();
grid.setColumns(arrayOfData.size());
for (Iterator iter = arrayOfData.iterator(); iter.hasNext();) {
Object value = iter.next();
HtmlOutputText text = new HtmlOutputText();
text.setValue(value);
grid.getChildren.add(text);
} -
Need a report column to hold data for one row only
Hey Guys,
I have a report which has a column that links to another page in my APEX application.
There is a requirement where only one of the rows in this report needs to have a link so I need the column to show the page link for one row and one row only.
The report will have about 5 rows at a time so is there a way to just make this link appear for the one row(it will be the top row) in the column attirbute in APEX? or can this be done in the SQL for the report?
Any help is much appreciated
Thanks
-MarkHi
The only way (I believe) to do this is within the SQL. Then you just wrap the column in a CASE statement and if it meets your criteria then build up the link and if not then display normally.
Something like this...
SELECT ename,
CASE WHEN empno = 7839
THEN '<a href="f?p='||:APP_ID||':4:'||:APP_SESSION||'::NO::P4_TARGET_ITEM:'||empno||'" >'||empno||'</a>'
ELSE TO_CHAR(empno)
END empno
FROM empCheers
Ben -
Write to spreadsheet file.vi is storing data in one row only.
The 8 points of data is going into one column in the spreadsheet. In the "Write to spreadsheet file string.vi" how do I write the 8 points to one row for each cycle?
I got this VI from NI's web a couple of years ago and forgot how to modify this part. I usume it is within the write file.vi.
Thank you in advance
SkipI just reread your original post and the way the "Write to Spreadsheet File.vi" that ships with LV works by default is to put 1D arrays into rows. I read your post backwards and told you how to put the data in a column. Sorry.
In any case, perhaps you need to make sure the Transpose input ISN'T true, and that the delimiter IS a tab.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Two rows as one display the data in one row
Hello All,
I would like to have data of two rows put in one as:
Lets say the data is like this:
SELECT * FROM TEST;
COL1 COL2 COL3 C
1.5 3 1 M
2 1 C
2.5 2 C
3.5 2 M
4.5 3 M How do i get the output as :
COL1 COL2 COL3 COL4 COL5
1.5 3 1 M 2
2.5 2 C 3.5
4.5 3 M If there are two rows with same value in Col3, then col5(a new dummy column in select stmt) the second row's col2 should be disaplyed in Row 1.
Can we do it in a Select Statement ?
Regds,
AmkotzA try :
SQL> select * from Amkotz;
COL1 COL2 COL3 C
1,5 3 1 M
2 1 C
2,5 2 C
3,5 2 M
4,5 3 M
SQL> select a.col1,
2 a.col2,
3 a.col3,
4 a.col4,
5 max(decode(a.rowid,b.rowid,null,b.col2)) keep (dense_rank last order by a.col1,a.col2) as col5
6 from (select Amkotz.*, row_number() over (partition by col3 order by col1,col2) rn from Amkotz) a, Amkotz b
7 where a.rn=1
8 and a.col3=b.col3
9 group by a.col1,
10 a.col2,
11 a.col3,
12 a.col4;
COL1 COL2 COL3 C COL5
1,5 3 1 M 2
2,5 2 C 3,5
4,5 3 M Nicolas. -
Depicting multiple rows' data in one row
Hi All,
Pls. check the below query:
select manager_id mg_id, employee_id emp_id, last_name name from employees
where manager_id = '100'
and DEPARTMENT_ID = '80'if i run the following query, then o/p comes row wise; like below:
mg_id emp_id name
100 145 Russell
100 146 Partners
100 147 Errazuriz
100 148 Cambrault
100 149 Zlotkeybut if i want the o/p like below; i.e; under manager # 100, all employees' emp_id and name should come in only ONE row NOT in multiple rows:
mg_id emp_id name emp_id name emp_id name emp_id name emp_id name
100 145 Russell 146 Partners 147 Errazuriz 148 Cambrault 149 Zlotkeypls. help me to sort out the above sought o/p.
kindly tell me if there is any posting guidelines (except "Plain Text Help" on the right side) in this forum. i tried a lot to post above two o/p in easily readable format, but couldn't do that.
Edited by: Shariful on Sep 20, 2009 4:28 AM
Edited by: Shariful on Sep 20, 2009 4:29 AMHi,
Shariful wrote:
Hi All,
Pls. check the below query:
select manager_id mg_id, employee_id emp_id, last_name name from employees
where manager_id = '100'
and DEPARTMENT_ID = '80'
if i run the following query, then o/p comes row wise; like below:
mg_id emp_id name
100 145 Russell
100 146 Partners
100 147 Errazuriz
100 148 Cambrault
100 149 Zlotkey
but if i want the o/p like below; i.e; under manager # 100, all employees' emp_id and name should come in only ONE row NOT in multiple rows:
mg_id emp_id name emp_id name emp_id name emp_id name emp_id name
100 145 Russell 146 Partners 147 Errazuriz 148 Cambrault 149 ZlotkeyIf you want all the emp_ids and names concatenated into one big VARCHAR2 column, that's called String Aggregation
[AskTom.oracle.com|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402] shows several different ways to do it.
You can format that one big column so that it looks like separate columns.
If you want each emp_id and name in its own column, that's called Pivoting .
Look up "pivot" for various techniques. If you do not know exactly how many rows were in the original query (and therefore how many columns you'll need in the output), then it will require Dynamic SQL , which can be complicated.
Unfortunately, when you do search for "pivot", mlost of the hits will be things like "Search for pivot and you'll get lots of examples".
Re: Help for a query to add columns is one that actually has some information. It was a question very much like yours.
kindly tell me if there is any posting guidelines (except "Plain Text Help" on the right side) in this forum. i tried a lot to post above two o/p and query in easily readable format, but couldn't do that.Type these 6 characters:
(small letters only, inside curly brackets) before and after formatted text, to preserve spacing. -
How to show three more than one row as single row
for example there are two tables employee and department.
emp id dept_id
101 1
101 2
101 3
Due to different dept id i am getting three rows for same emp id. Is there anwyay i can show one row and all three departments into one line.
output like this 101 1/2/3
Please help!
Thanks864470 wrote:
However, I am not getting any distinct values for that.Are you sying there are multiple records for same emp_id, dept_id combination? If so:
SQL> with t as (
2 select 101 emp_id,1 dept_id from dual union all
3 select 101,2 from dual union all
4 select 101,2 from dual union all
5 select 101,3 from dual
6 )
7 -- end of on-the-fly data sample
8 select emp_id,
9 rtrim(xmlagg(xmlelement(d,dept_id,'/').extract('//text()') order by dept_id),'/') dept_list
10 from t
11 group by emp_id
12 /
EMP_ID DEPT_LIST
101 1/2/2/3
SQL> with t as (
2 select 101 emp_id,1 dept_id from dual union all
3 select 101,2 from dual union all
4 select 101,2 from dual union all
5 select 101,3 from dual
6 )
7 -- end of on-the-fly data sample
8 select emp_id,
9 rtrim(xmlagg(xmlelement(d,dept_id,'/').extract('//text()') order by dept_id),'/') dept_list
10 from (
11 select emp_id,
12 dept_id
13 from t
14 group by emp_id,
15 dept_id
16 )
17 group by emp_id
18 /
EMP_ID DEPT_LIST
101 1/2/3
SQL> SY. -
Combining data on one row of a report
Post Author: sdgroves
CA Forum: General
I am trying to pull data from a Student Management System. I specifically need the data from the SMS to show up like this:
Student Name Student ID English Class History Class Math Class
Jones, Rick 123456 Johnson Landers Jones
Right now I can get it to pull all of the data above but it brings it back on seperate rows:
Student Name Student ID English Class History Class Math Class
Jones, Rick 123456 Johnson
Jones, Rick 123456 Landers
Jones, Rick 123456 Jones
Any idea on how to get it to report back all on one row?
Thanks!Post Author: sdgroves
CA Forum: General
All of the data for the classes is coming from the same field on my report. That may be the problem. I may need to add a class period or something so it differentiates between classes?
Thanks for your help. -
Splitting comma seperated column data into multiple rows
Hi Gurus,
Please help me for solving below scenario. I have multiple value in single column with comma seperated values and my requirement is load that data into multiple rows.
Below is the example:
Source Data:
Product Size Stock
ABC X,XL,XXL,M,L,S 1,2,3,4,5,6
Target Data:
Product Size Stock
ABC X 1
ABC XL 2
ABC XXL 3
ABC M 4
ABC L 5
ABC S 6
Which transformation we need to use for getting this output?
Thanks in advance !Hello,
Do you need to do this tranformation through OWB mapping only? And can you please tell what type of source you are using? Is it a flat file or a table?
Thanks -
Hello,
I hope some1 can help me for these.
I am using apex 3.1.2 ver
My first question: how can I put more columns for example 4 columns with heading in one row? when I do, screen is too wide but i do not want scrolling?
e.g
aaaaaaaaaaaaaaa( ) bbbbbbbbbbbbbb ( ) ccccccccccccccccc ( ) ddddddddddd( )
second question?
how can i display second column value based on first column value before saving the page?
e.g. aaaaaaa(1) bbbbbbbb(should display text value based on first column)
for example 1 - abc
2 - def
3 - ghi and so on.
last question? how can i disable the column? should column enable based on other column? e.g if a then second column take value other disabled?
Many thx.
kind regards,Irha10 wrote:
how can I put more columns for example 4 columns with heading in one row? when I do, screen is too wide but i do not want scrolling?In item property change "Begin on new Line " to "Yes"
Irha10 wrote:
how can i display second column value based on first column value before saving the page?01. You have to create a branch to same page
02. Submit the page using any event (such as button press or something). So when you enter details to first item and then press button then page will submit and reload the same page.
03. In the page create a before region process and check whether second item is not null and third item is null then populate third item. Then first item is not null and second item null then populate second item.
Irha10 wrote:
? how can i disable the column? should column enable based on other column? e.g if a then second column take value other disabled?You can use a java script and enable and dissable item based on any condition such as value of another item
Example
if ($x('P16_YYY').value !='SOME VALUE')
$x('P16_XXX').disabled = true;
}else
$x('P16_XXX').disabled = false;
} -
4.0 EA1 - Data Modeler does not show columns data types correctly
Data Modeler shows all columns data types as 'unknown'.
Hi,
you need to check "system data types" directory and it contents. Its default location in SQL Developer is sqldeveloper\sqldeveloper\extensions\oracle.datamodeler\types
Check "Preferences>Data Modeler>Default system data types directory" setting. If it's empty then copy defaultdomains.xml from previous installation to directory above.
If it's not empty then you need to copy types.xml and defaultRDBMSSites.xml from default location to directory set as "Default system data types directory".
Philip -
How to show the data of one query since Forms9i using to Report built-in on
Hello!!!, I have Developer 9i (Forms and Reports), the OCJ4 and repserver90 are running, now, I attempt to run one report from Forms9i, and only it appears an empty page HTML. I don't understand why doesn't show the data of query?
Please, give me a solution for this problem, thanks for your help.
PD: I am using the below code.......
PROCEDURE bring_report IS
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status VARCHAR2(20);
BEGIN
repid := find_report_object('Q_DATA1');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,BATCH);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'html');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'repserver90');
v_rep := RUN_REPORT_OBJECT(repid);
rep_status := REPORT_OBJECT_STATUS(v_rep);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(v_rep);
END LOOP;
IF rep_status = 'FINISHED' THEN
/*Display report in the browser*/
WEB.SHOW_DOCUMENT('http://172.16.2.18:8888/reports/rwservlet/getjobid'||
substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=repserver90','_blank');
ELSE
message('Error when running report');
END IF;
END;Alex,
the code does look good. maybe the Reports query does not produce an output. You can trace this ny adding a header on top of teh Reports (e.g. a date or just saying "Hello World"). So instead of an empty page this should now show the text strings. If you don't see the string then there is something else going on. Since you are not getting any error message I assume that the Reports itself executes fine.
Frank -
Compare column data of two rows
Hi there,
I a have a table
COMP_ID PROD COLOR COMPAREFLAG ORDER_NUMBER
1 sun red - 2
2 sun blue Y 2
3 horse black - 1
4 horse white Y 1
5 chair black - 3
6 chair black Y 3I would like to compare for example the columns PROD and COLOR of two rows with ORDER_NUMBER = 2
The row with COMP_ID = 1 is the first entry and with COMP_ID = 2 the second one therefore the COMPAREFLAG is set to 'Y'.
If the entries are diffrent both rows should be return to output.
I would like to compare also the rows with COMP_ID 5 and 6. In this case nothing should be return to output.
I don't know how to manage this. Can anyone please help me?
Thanks,
ben
Message was edited by:
ben512I hope that I well understand.
Do you want to get rows only if PROD/COLOR of one row is different of the PROD/COLOR from other row (with the same order_number) ?
What you can try :
SQL> with tbl as
2 (select 1 comp_id, 'sun' prod, 'red' color, null compareflag, 2 order_number from dual union all
3 select 2 comp_id, 'sun' prod, 'blue' color, 'Y' compareflag, 2 order_number from dual union all
4 select 3 comp_id, 'horse' prod, 'black' color, null compareflag, 1 order_number from dual union all
5 select 4 comp_id, 'horse' prod, 'white' color, 'Y' compareflag, 1 order_number from dual union all
6 select 5 comp_id, 'chair' prod, 'black' color, null compareflag, 3 order_number from dual union all
7 select 6 comp_id, 'chair' prod, 'black' color, 'Y' compareflag, 3 order_number from dual )
8 select comp_id, prod, color, compareflag, order_number
9 from (select comp_id,
10 prod,
11 decode(first_value(prod) over (partition by order_number order by comp_id range between unbounded preceding and unbounded following),
12 last_value(prod) over (partition by order_number order by comp_id range between unbounded preceding and unbounded following),null,prod) prod_d,
13 color,
14 decode(first_value(color) over (partition by order_number order by comp_id range between unbounded preceding and unbounded following),
15 last_value(color) over (partition by order_number order by comp_id range between unbounded preceding and unbounded following),null,color) color_d,
16 compareflag,
17 order_number
18 from tbl
19 where order_number=&order_number)
20 where (prod_d is not null or color_d is not null)
21 order by 1;
Enter value for order_number: 1
old 19: where order_number=&order_number)
new 19: where order_number=1)
COMP_ID PROD COLOR C ORDER_NUMBER
3 horse black 1
4 horse white Y 1
SQL> /
Enter value for order_number: 2
old 19: where order_number=&order_number)
new 19: where order_number=2)
COMP_ID PROD COLOR C ORDER_NUMBER
1 sun red 2
2 sun blue Y 2
SQL> /
Enter value for order_number: 3
old 19: where order_number=&order_number)
new 19: where order_number=3)
no rows selected
SQL> Nicolas.
Maybe you are looking for
-
Air 3.9 Crashes with OS X Mavericks 10.0
Can anyone tell me if Air 3.9 is compatible with OS X Mavericks 10.9? I have two keyword applications that are crashing now that I hve updated. - Rusty
-
Bridge CS4 not using newly installed Enhanced Image Processing Photoshop script
Hi all, Hope someone can help here. We just added this Photoshop extention: Enhanced Image Processor by Manovi to our Photoshop CS4's Presets/Scripts folder. Here's my problem. The new image processor opens and runs great - in Photoshop. But whe
-
Hi all, I want to publish one report that generates lots of rows (it has about 15 columns). And I also want it to be exported to Excel. The problem is when the report has a lot of rows, it doesn't work: - Is there any configuration file to limit the
-
I have a couple of complaints about importing video into iTunes 12. When I (1) When changing the media type to TV Show, you have the save that change, then move to TV Shows, find the file then add the Show Info. In previous versions, you could do a
-
How to disable and enable a Hardware Card on my Mac
Hi all, I have a system with2 BlackMagicDesign (BMD) Decklink cards in it. One HD Extreme and one HD Extreme 3D+ card. I use it to capture multiple video streams at once and it works perfectly. I can choose to input and output card for audio, etc...