Two column results based on one column
Tool#
Time
102
12
104
5
108
0
111
5
112
8
114
0
117
0
120
0
125
15
189
7
I have a table like this in numbers where the time is updated using the formula;
=SUM((IF($N$4="Y",SUMIF($A$5:$A$13,"=102",$B$5:$B$13),"0"),IF($N$5="Y",SUMIF($D$ 5:$D$13,"=102",$E$5:$E$13), "0"), .... etc.
The tables that the SUMIF's are referring to are set and constant with times for each tool based on a specific job number. The table with the TRUE or FALSE (ie. Y or N) is where the input is put in order to get the times for each tool from the constant tables and the employee will put in either Y or N.
What I want to do is create another table from the one above where I can eliminate the tools that have "0" time, but still follow the exact same format (ie. still shows both "Tool#" and "Time" in two seperate columns). How do I do this? How can I have a table where it only gives results based on the second column, but returns both the first and second columns?
Hope this all makes sense. If you need further information to help me just ask and I can post more about the specifics.
FE,
Have you considered using the Row Filter in the Reorganize Panel? Since your hours are calculated it should work well for you.
Jerry
Similar Messages
-
From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?
Hi,
Use NVL or COALESCE:
NVL (col_a, col_b)
Returns col_a if col_a is not NULL; otherwise, it returns col_b.
Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Formating the Row Based on one column value
Hi Friends
I am trying to format the Entire row based on the value of the first column in my Answers.
Example if first column value in 'F' now i want the Entire row to be colored
I can do conditional formating on one column but i want to do it on the entire row
F 8.1 % 12.0 %
E 5.2 % 3.5 %
M 2.3 % 3.3 %
If any one has done this or any suggestions please respond
Thanks
SangIts a Pivot View
F 8.1 % 12.0 %
E 5.2 % 3.5 %
M 2.3 % 3.3 %
the column 1 --> F,E,M are the Product
the column 2 --> 8.1% , 5.2% , 2.3% are the sales in year 2008
the column 3 --> 12.0 % , 3.5 %, 3.3 % are the sales in year 2009
So will i be able to apply the formating in pivot view based on one column to other column If yes please let me know how or
suggest if this can be done using the BI Office , or BI publisher
sing the BI Office i can do the formating in Excel but once i refresh the data all the formating is gone ... :(
I am donno BI Publisher if we have to use BIP please suggest any solution its very very very urgent and important report formating they need here ....
Thanks in advance David
sango -
Can we concatenate 2 columns of datafile into one column in sql loader
Hi,
Can we concatenate 2 columns of datafile into one column in sql loader?
like
Suppose there are two field in data file
column1 - lastname value tiger
column2 - firstname value scott
Required result
sould be concatenate of the two field into one database coulmn
like name and value should be scott tiger.
ThanksOr try this...
My input file
1,KARTHICK,PATTABIRAMAN,SOFTWARE
2,VIJAY,RENGANATHAN,FINANCE
3,VIMAL,KANTH,SALESAnd my control file.
LOAD DATA
INFILE 'EmpDetail.txt'
BADFILE 'EmpDetail.bad'
DISCARDFILE 'EmpDetail.dsc'
INTO TABLE "EMPDETAIL"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
(NO,
NAME1 BOUNDFILLER,
NAME ":NAME1||' '||:NAME",
DEPT) My table is.
SQL> create table empdetail(no integer, name varchar2(50), dept varchar2(50))
2 /
Table created.Then i loaded the data.
D:\karthick\Akiva\Look up\Akiva\Address Look Up>sqlldr sysadm/sysadm@akivanew empdetail.ctl
SQL*Loader: Release 9.2.0.1.0 - Production on Mon Sep 15 12:23:42 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Commit point reached - logical record count 2
Commit point reached - logical record count 3And the output is
SQL> select * from empdetail
2 /
NO NAME DEPT
1 KARTHICK PATTABIRAMAN SOFTWARE
2 VIJAY RENGANATHAN FINANCE
3 VIMAL KANTH SALESThanks,
Karthick. -
Two Dimension Hierarchys based on one Logical Table
Is it possible to have two dimesion hierarchys based on one logical table? Suppose we have the following case:
Accounts Table
Code
Name
Category
Subcategory
Level 1
Level 2
Level 3
I would like to have one dimension Total > Category >Subcategory > Code and one Total > Level 1 > Level 2 > Level 3 > Code, so I can drill down on both paths. Is this possible?
ThanxYes, the trick is to have the same key on the lowest level in your hierarchy.
regards
John
http://obiee101.blogspot.com/ -
How to split the data based on one column
Dear All,
I have the table data like this.
type quantity revenue_mny count country
a 10 10 2 India
a 20 12 3 India
b 30 15 1 India
a 35 20 2 US
b 20 10 1 US
b 60 15 1 US
I woulkd like to split the date based on type column.
For each country, for Type "a" get the sum of revenue count quanity ans same for b
and all shuld come in on row for each country.
output should be like
country revenue_mny(For a) quantity(for a) count(For a) revenue_mny(for b) quantity(for b) count(For b)
India 22 30 5 15 30 1
US 20 35 2 25 80 2
I tried the below query . its not splittng the date for each country in one row.
select country,
sum(case when type='a') then revenue_mny else 0 end ) revenue_mny_a,
sum(case when type='b' then revenue_mny else 0 end ) revenue_mny_b
sum(case when type='a' then quantity else 0 end) quantity_a,
sum(case when type='b' then quantity else 0 end) quantity_b from
test
group by country
Please need your heloLike this?
with t as
select 'a' type, 10 quantity, 10 revenue_mny, 2 cnt, 'India' country from dual union all
select 'a', 20, 12, 3, 'India' from dual union all
select 'b', 30, 15, 1, 'India' from dual union all
select 'a', 35, 20, 2, 'US' from dual union all
select 'b', 20, 10, 1, 'US' from dual union all
select 'b', 60, 15, 1, 'US' from dual
select country,
sum(case when type='a' then revenue_mny else 0 end ) revenue_mny_a,
sum(case when type='a' then quantity else 0 end) quantity_a,
sum(case when type='a' then cnt else 0 end) cnt_a,
sum(case when type='b' then revenue_mny else 0 end ) revenue_mny_b,
sum(case when type='b' then quantity else 0 end) quantity_b ,
sum(case when type='b' then cnt else 0 end) cnt_b
from t
group by country;result:
COUNTRY REVENUE_MNY_A QUANTITY_A CNT_A REVENUE_MNY_B QUANTITY_B CNT_B
India 22 30 5 15 30 1
US 20 35 2 25 80 2Or you can do it with a decode instead of case. The result will be the same:
with t as
select 'a' type, 10 quantity, 10 revenue_mny, 2 cnt, 'India' country from dual union all
select 'a', 20, 12, 3, 'India' from dual union all
select 'b', 30, 15, 1, 'India' from dual union all
select 'a', 35, 20, 2, 'US' from dual union all
select 'b', 20, 10, 1, 'US' from dual union all
select 'b', 60, 15, 1, 'US' from dual
select country,
sum(decode(type,'a',revenue_mny,0)) revenue_mny_a,
sum(decode(type,'a',quantity,0)) quantity_a,
sum(decode(type,'a',cnt,0)) cnt_a,
sum(decode(type,'b',revenue_mny,0)) revenue_mny_b,
sum(decode(type,'b',quantity,0)) quantity_b,
sum(decode(type,'b',cnt,0)) cnt_b
from t
group by country;(I changed tablename from TEST to T and columnname from COUNT to CNT, because you should not use reserved words as tablename or columnname.)
Edited by: hm on 09.10.2012 06:17 -
Data in two different coulmns merge into one column
I am using following script to create external table with data.
CREATE TABLE external_class(
item_no varchar2(255),
max_range varchar2(255)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY DATALOAD
ACCESS PARAMETERS
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
(item_no,max_range)
LOCATION ('class_newc.txt')
REJECT LIMIT UNLIMITED;
Problem is that its merge both columns into one column.
I want two seperate columns.
Data is in microsoft excel spread sheet.
I saved as txt(TAB DELIMITED) txt
Data appears in clas.txt file as below:
"400 " 4177.64
"404 " 5574.64
"406 " 5333
"408 "
"409 "
"450 " 10.83
"478 "
"482 " 4820
I ran the above script to create table.
Table Created
SQL> desc external_class;
Name Null? Type
ITEM_NO VARCHAR2(255)
MAX_RANGE VARCHAR2(255)
SQL> select count(*) from external_class;
COUNT(*)
3036
but with
select * from external_class;
ITEM_NO MAX_RANGE
"400"4177.64
"404"5574.64
"406"5333
"408"
"409"
"450"10.83
"478"
"482"4820thanks its work.
Actually I created other file as below
Item_no-----max_range
400 4177.64
404 5574.64
406 5333
408
409
450 10.83
and use creation script as below:
CREATE TABLE external_class(
item_no varchar2(255),
max_range varchar2(255)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY DATALOAD
ACCESS PARAMETERS
RECORDS DELIMITED BY NEWLINE
fields terminated by whitespace
MISSING FIELD VALUES ARE NULL
(item_no,max_range)
LOCATION ('class_newa.txt')
REJECT LIMIT UNLIMITED; -
Deleting duplicate entries based on one column
Guys,
I have two internal tables i_tab1 and i_tab2.
I want to copy contents of i_tab1 into i_tab2 while removing any duplicate entry.
i am comparing on just one column in i_tab1.Hi,
Try this way
LOOP AT itab2 INTO wa_itab2.
READ TABLE itab1 INTO wa_itab1 WITH KEY field = wa_itab1-field BINARY SEARCH.
IF sy-subrc = 0.
code
MODIFY itab2 INDEX sy-tabix FROM wa_itab2 TRANSPORTING field. " field is modified field
ENDIF.
ENDLOOP.
Regards
Bala Krishna -
Selecting rows based on one column change
Hi All -
I need to select the rows from a table (this table has 4 columns and has a primary key and have many records for that primary key).
I need to select all the rows for this primary key for which only one column (in this case "flag" column) has been changing from its past value.
How can I do this?
for example, table data is:
ID, flag, Profile,date
pk, Y, Profile4,01/10/10
pk, N, Profile4, 01/08/10
pk,N, Profile3, 01/07/10
pk,Y, Profile3, 01/05/10
pk,Y, Profile2, 01/03/10
pk,N, Profile1, 01/02/10
The output of the query I am looking for should return the following i.e. only retrieve rows whose previous flag value has been changed:
ID, flag, Profile,date
pk, Y, Profile4,01/10/10
pk,N, Profile3, 01/07/10
pk,Y, Profile2, 01/03/10
pk,N, Profile1, 01/02/10
Please share your expertise.
Thanks,
SeenuHi, Seenu,
Centinul wrote:
It is always helpful to provide the following:
1. Oracle version (SELECT * FROM V$VERSION)
2. Sample data in the form of CREATE / INSERT statements.
3. Expected output
4. Explanation of expected output (A.K.A. "business logic")
5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
Seenu001 wrote:(1) Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for Solaris: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production Good!
(2) select 'pk' id,'Y' flag,'Profile4' profile,to_date('01/10/10','mm/dd/yy') dt from dual union all
select 'pk','N','Profile4',to_date('01/08/10','mm/dd/yy') from dual union all
select 'pk','N','Profile3',to_date('01/07/10','mm/dd/yy') from dual union all
select 'pk','Y','Profile3',to_date('01/05/10','mm/dd/yy') from dual union all
select 'pk','Y','Profile2',to_date('01/03/10','mm/dd/yy') from dual union all
select 'pk','N','Profile1',to_date('01/02/10','mm/dd/yy') from dualNot bad. It can be made into a CREATE TABLE AS statement without a lot of work, but if you're not willing to do that little bit or work, why should anyone else?
(3) Expected output: I want all the rows from this table where the flags have been changed from its previous value.That's a vague description. Post the exat output, like Solomon did:
ID F PROFILE DT
pk N Profile1 01/02/2010
pk Y Profile2 01/03/2010
pk N Profile3 01/07/2010
pk Y Profile4 01/10/2010
(4) I want all the rows from this table where the flags have been changed from its previous value.That's a repeat of the vague description. Explain how you get the crorrect results, with specific examples, like this:
"The row dated January 2 should be included, because it is the oldest row in the table, regardless of what its flag is.
The row dated January 3 should be included because ...
The row dated January 5 should *not* be included, because ..."
You don't have to explain every row, just every reason.
Solomon - I tried your query but the prev_flag is not being populated, it shows null value '-'NULL is not the same as '-'. Did you issue a command like
SET NULL "-"that would display a '-' instead of NULL?
Solomon's query works fine for me, as it did for him. Post your code, even if you just copied it from this site. (There may have been an editing problem.)
Frank - I tried your query, prev_flag is populated in this case but when I am using with the WITH clause, I am getting an error saying "unsupported column aliasing" , I guess WITH command doesnt allow use of column alias. The problem is that I forgot the keyword AS after the sub-query name.
WITH got_prev_flag AS
SELECT id, flag, profile, dt -- DATE is not a good column name
, LAG (flag, 1, '??') OVER (ORDER BY dt) AS prev_flag
FROM t
-- WHERE ... -- any filtering goes here
SELECT id, flag, profile, dt
FROM got_prev_flag
WHERE flag != prev_flag
;If you don't post data in an executable form, then people can't test their ideas. If people can't test their ideas, trivial mistakes like this are very likely.
This flag column will have either
Y or N columns. Could you tell me what is the use of "??" value.By default, LAG returns NULL for the first row. If you want to include the first row in the results, then "WHERE flag != prev_flag" won't work when prev_flag is NULL. We could explicitly check for "prev_flag IS NULL", but I find it cleared to override the default, and have LAG return '??' on the first row. I guessed that '??' would make the condition "WHERE flag != prev_flag" work, no matter what value flag had. There's nothing magical about '??'; you can use any string that will never actually match flag. -
Concate 3 column data in to one column.
I would like to concate 3 columns in to one column. all three column has datatype as LONG. Is any one knows how to concate long datatype column into one column?
Thanks in Advance812294 wrote:
Is there any way to not use CLOB datatype? I am fetching data from three different tables.And what fetching from three different tables has to do with CLOB?
SQL> set serveroutput on
SQL> declare
2 concat_result clob;
3 tmp long;
4 begin
5 select text
6 into tmp
7 from dba_views
8 where rownum = 1;
9 concat_result := tmp;
10 select data_default
11 into tmp
12 from dba_tab_columns
13 where data_default is not null
14 and rownum = 1;
15 concat_result := concat_result || tmp;
16 select search_condition
17 into tmp
18 from dba_constraints
19 where search_condition is not null
20 and rownum = 1;
21 concat_result := concat_result || tmp;
22 dbms_output.put_line(concat_result);
23 end;
24 /
select
"LIB_IDX","LIB_NAME","VENDOR_NAME","PROTOCOL_NUM","VERSION_NUM","PATH_NAME","MAP
_FILE","FILE_CFGID","MAP_ELEM","ELEM_CFGID","MAP_SYNC" from v$map_library0 OBJ#
IS NOT NULL
PL/SQL procedure successfully completed.
SQL> SY. -
How do I return results based on 2 columns?
I've been having an issue and cannot figure it out for the life. First, here's an example set of the data I'm using so you can see exactly what I'm asking.
Emplid Effdt Effseq
10001 '01-JAN-99' 0
10001 '01-JUL-11' 0
10001 '01-JUL-11' 1
10001 '01-JUL-11' 2
10001 '01-JUL-12' 3
What I need to do here, is obtain 3 rows. The 3 rows I need are rows 1, 4, and 5. I need row 1 because its a completely different date. I need row 5 for the same reason: it's a different date. The issue arises with how I can obtain row 4. The problem is that because rows 2, 3, and 4 all have the same effective date(effdt), SQL Developer just returns one of those rows. Because those 3 rows all have the same effective date(effdt), the tie breaker becomes the effective sequence(effseq) number. When the effective date(effdt) is the same, you need to grab the maximum effective sequence(effseq) number and return that whole row's results such as the emplid, effdt, and effseq. It seems so straight forward and something you can use a subquery for, but its not that simple. Note, that you can specifically use the emplid = 10001 in any specific form because there's many employee id's. Also, the rows will not be in a specific order so you cannot just always grab rows 1, 4, and 5. Some employees may only have a single row in the database, and some may have 50 rows. Everything solely depends on the combination of employee id(emplid), effective date(effdt), and effective sequence(effseq) as the tie breaker. Any help in solving this problem would be greatly appreciated. Thank you in advance.WITH t
AS (SELECT 10001 emplid,
TO_DATE ('01-JAN-1999', 'dd-mon-yy') effdt,
0 effseq
FROM DUAL
UNION ALL
SELECT 10001, TO_DATE ('01-JUL-2011', 'dd-mon-yy'), 0 FROM DUAL
UNION ALL
SELECT 10001, TO_DATE ('01-JUL-2011', 'dd-mon-yy'), 1 FROM DUAL
UNION ALL
SELECT 10001, TO_DATE ('01-JUL-2011', 'dd-mon-yy'), 2 FROM DUAL
UNION ALL
SELECT 10001, TO_DATE ('01-JUL-2012', 'dd-mon-yy'), 3 FROM DUAL)
SELECT emplid, effdt, effseq
FROM (SELECT t.*,
ROW_NUMBER ()
OVER (PARTITION BY emplid, effdt ORDER BY effseq DESC)
rn
FROM t)
WHERE rn = 1
EMPLID
EFFDT
EFFSEQ
10001 1/1/1999 0
10001 7/1/2011 2
10001 7/1/2012 3 -
Selecting top 10 rows based on one column.
Hi,
I need to display the top 10 records for each distinct value of a column.USE Northwind;
-- Solution 1
SELECT S.SupplierID, S.CompanyName, CA.ProductID, CA.UnitPrice
FROM dbo.Suppliers AS S
CROSS APPLY
(SELECT TOP (10) *
FROM dbo.Products AS P
WHERE P.SupplierID = S.SupplierID
ORDER BY UnitPrice DESC, ProductID DESC) AS CA
ORDER BY S.SupplierID, CA.UnitPrice DESC, CA.ProductID DESC;
-- Solution 2
WITH C AS
SELECT S.SupplierID, S.CompanyName, P.ProductID, P.UnitPrice,
ROW_NUMBER() OVER(
PARTITION BY P.SupplierID
ORDER BY P.UnitPrice DESC, P.ProductID DESC) AS RowNum
FROM dbo.Suppliers AS S
JOIN dbo.Products AS P
ON P.SupplierID = S.SupplierID
SELECT SupplierID, CompanyName, ProductID, UnitPrice
FROM C
WHERE RowNum <= 10
ORDER BY SupplierID, ProductID DESC, UnitPrice DESC;
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
PHP create array/variable for two dropdowns and insert into one column
Hello,
I have been trying for days to get this to work. Any help would be very appreciated.
The dropdown code:
<?php //Dropdowns for hours and minutes
$hour = array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
$min = array (.00, .25, .50 ,.75);
echo '<span class="red">Hours :</span><select name="hour">';
foreach ($hour as $value1) {
echo "<option value=\"$value1\">$value1</option>\n";
echo '</select>';
echo '<span class="red">Quarter Hours :</span><select name="min"';
foreach ($min as $value2) {
echo "<option value=\"$value2\">$value2</option>\n";
echo '</select>';
//Dropdowns for hours and minutes
//Create variable to send to the time field using a hidden field
function input_time($value1, $value2) {
$time = count($value1 + $value2);
return $input_time;
?>
<input name="time" type="hidden" value="<?php echo "$input_time";?>" />
The Schema:
CREATE TABLE `ND_time_sheet` (
`time_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`day` varchar(10) NOT NULL DEFAULT '',
`date` varchar(8) NOT NULL DEFAULT '',
`project_id` varchar(8) DEFAULT NULL,
`non_bill` tinytext,
`staff_id` varchar(5) NOT NULL DEFAULT '',
`time` decimal(3,2) unsigned zerofill DEFAULT NULL,
`type` varchar(30) NOT NULL DEFAULT '',
PRIMARY KEY (`time_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Thanks!9677670421 wrote:
hi... i am trying to do the same but i am having the 2D array of data when first time if i clicked in table it should show the the first row values and if i again clicked same value should show in the second row and so on... but insted in my code if clicked (using insert into array ) at a time it is showing two rows of the data pl help me ..........
This seems to be a different problem, so you should have started a new thread instead.
Can you show us your code, tell us what you are clicking, tell us what you get and what you expect to get instead. Thanks.
LabVIEW Champion . Do more with less code and in less time . -
How to achieve grouping of data based on one column
Hello PL/SQL Gurus/experts,
I am using Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production version
I have following table -
DROP TABLE T2;
create table T2(Manager,Employee) as select
'Nikki','Ram' from dual union all select
'Nina', 'Rita' from DUAL union all select
'Mike', 'Radha' from dual union all select
'Michael', 'Ratnam' from DUAL union all select
'Hendi', 'Ratna' from dual union all select
'Robert', 'Raman' from dual union all select
'Maria', 'Rolly' from dual union all select
'Kistrien', 'Rachna' from dual union all select
'Andrew', 'Ritvik' from dual union all select
'Emma', 'Ramesh' from dual union all select
'Andy', 'Ranpal' from dual union all select
'Brandy', 'Raunak' from dual union all select
'Nikki','Shyam' from dual union all select
'Nina', 'Sita' from DUAL union all select
'Mike', 'Sadhna' from dual union all select
'Michael', 'Satnam' from DUAL union all select
'Hendi', 'Satna' from dual union all select
'Robert', 'Samar' from dual union all select
'Maria', 'Sameer' from dual union all select
'Kistrien', 'Samrachna' from dual union all select
'Andrew', 'Satvik' from dual union all select
'Emma', 'Somesh' from dual union all select
'Andy', 'Sonpal' from dual union all select
'Brandy', 'Samar' from dual union all select
'Emma', 'Piyush' from dual union all select
'Andy', 'Pavan' from dual union all select
'Brandy', 'Paramjeet' from dual;Expected output -
Manager Employee
Nikki
Ram
Shyam
Nina Rita
Sita
Mike Radha
Sadhna
Michael Ratnam
Satnam
Hendi Ratna
Satna
Robert Raman
Samar
Maria Rolly
Sameer
Kistrien Rachna
Samrachna
Andrew Ritvik
Satvik
Emma Ramesh
Somesh
Piyush
Andy Ranpal
Sonpal
Pavan
Brandy Raunak
Samar
ParamjeetI thank to all of you in advance for your valuable time and inputsIn SQL, something like this...
SQL> ed
Wrote file afiedt.buf
1 select case when row_number() over (partition by emp.manager order by employee) = 1 then
2 mgr.manager
3 else
4 null
5 end as manager
6 ,emp.employee
7 from (select distinct manager from t2) mgr
8 join t2 emp on (mgr.manager = emp.manager)
9* order by mgr.manager, emp.employee
SQL> /
MANAGER EMPLOYEE
Andrew Ritvik
Satvik
Andy Pavan
Ranpal
Sonpal
Brandy Paramjeet
Raunak
Samar
Emma Piyush
Ramesh
Somesh
Hendi Ratna
Satna
Kistrien Rachna
Samrachna
Maria Rolly
Sameer
Michael Ratnam
Satnam
Mike Radha
Sadhna
Nikki Ram
Shyam
Nina Rita
Sita
Robert Raman
Samar
27 rows selected.If you want the managers on their own row with the employees underneath then you'll have to fudge it.
SQL> ed
Wrote file afiedt.buf
1 select case when row_number() over (partition by emp.manager order by employee nulls first) = 1 then
2 mgr.manager
3 else
4 null
5 end as manager
6 ,emp.employee
7 from (select distinct manager from t2) mgr
8 join
9 (select distinct manager, null as employee from t2
10 union all
11 select manager, employee from t2
12 ) emp on (mgr.manager = emp.manager)
13* order by mgr.manager, emp.employee nulls first
SQL> /
MANAGER EMPLOYEE
Andrew
Ritvik
Satvik
Andy
Pavan
Ranpal
Sonpal
Brandy
Paramjeet
Raunak
Samar
Emma
Piyush
Ramesh
Somesh
Hendi
Ratna
Satna
Kistrien
Rachna
Samrachna
Maria
Rolly
Sameer
Michael
Ratnam
Satnam
Mike
Radha
Sadhna
Nikki
Ram
Shyam
Nina
Rita
Sita
Robert
Raman
Samar
39 rows selected. -
How to re-calculate a column value based on another column value in the same ADF Table row
Hi,
I'm using Jdeveloper 11.1.2.3.0.
I have an adf table with 2 columns, columnA and columnB.
When the value changed in ColumnA,
1) i need to call a PLSQL and update the ColumnB value that is returned from PLSQL.
2) Show a warning message if the existing value in ColumnB is different from the one that is returned from PLSQL.
Can anybody suggest how can i accomplish this?
Thanks,
Vinodhi user,
if you have inputtext means have a valuechangelistener
in that call your pl/sql function supply input value to the appropriate function then grab the result of the function. then bind the column inputtext and compare with it. then raise your warning using FacesMessage classes.
Sameh Nassar: Create PL/SQL Function And Call It From Your ADF Application
Maybe you are looking for
-
IDVD, jerky when played + full screen problems
Dear all, I'm new to iDVD and am not sure what I've done wrong. I made QT movies from FCPx and imported them into iDVD. First I had problems with keeping it widescreen but have seem to have sorted that out. However now I have 2 more problems that hav
-
Just wanna know if there is a need for a graphics accelerator or driver for an iMac G3 display. Here are my display properties. ATY,Rage128VR: Chipset Model: ATY,Rage128VR Type: Display Bus: AGP VRAM (Total): 8 MB Vendor: ATI (0x1002) Device ID: 0x52
-
I want to delete photos from my ipad but the delete button will not accept the touch
How do I delete photos from my ipad the delete button will not work although the share button does?
-
Why does iTunes hate Oasis?
I ripped the album "Definitely Maybe" onto my computer with iTunes, then transferred it to my iPod. In iTunes, the tracks had their correct track numbers. However, on the iPod, it rearranges them in the wrong order. This is the only album out of abou
-
How to see Downloaded Apps?
How to see Downloaded Apps?