Merging two rows in report
Hi,
I want to merge two rows in my reprt.For ex:
<u>Now my report is showing in this format:</u>
Customer Plant Value
A B 0
B 12.5
<u>I want to make it as</u>
Customer Plant Value
A B 12.5
Any suggestions. Thanks.
You can try doing a lookup for your field A at the cube or the ODS level[in your update Rules].
You get two different records because your Field A is # not assigned in this record. Try populating your field A doing a lookup to other related ODS or cube based on your key fields. This would get you a single record with all the fields and a single record at the report level.
Similar Messages
-
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.
-
[Help] How to merge two rows in a datagrid?
How to merge two rows of a specific column in a datagrid?
ex.
|_______|_____|_____|
| merged |_____|_____|
|_______|_____|_____|
|_______|_____|_____|
thx a lot~I need to merge column heading. Have u find any solution for
ur problem? -
Vertical calcuation (Calcuation b/w two rows ) in Reports
I am trying to create an report, where, I want to see the % change between two rows. For Eg. What is the %age +/- between January 2008 and January 2009. I am not able to display that value in reports. I have two seperate reocords for each customer for january 2008 and January 2009. Any help will be really appreciated..
yudhvimor, you will get the best results if you post this question in the CRM On Demand Analytics and Reports forum. Thanks for your help.
-
Merging two rows into a single row
Hi ,
I wish to merge few columns of tow rows into a single row.
if i use union it gives two rows as o/p.
What is the exact sql statement for that?
ThanksHi Sridhar,
This is my code for merging and i used union.
Suggest me good solution.
CREATE OR REPLACE VIEW INSPECTINT.INSPECT_LOC_TRACKING_RPT_VIEW AS
SELECT
VEN_COMPANY_NAME VEN_COMPANY_NAME,
VEN_COMPANY_NAME_2 VEN_COMPANY_NAME_2,
VEN_CONTACT_FIRST_NAME VEN_CONTACT_FIRST_NAME,
VEN_CONTACT_MIDDLE_NAME VEN_CONTACT_MIDDLE_NAME,
VEN_CONTACT_LAST_NAME VEN_CONTACT_LAST_NAME,
VEN_ADDRESS_LINE_1 VEN_ADDRESS_LINE_1,
VEN_ADDRESS_LINE_2 VEN_ADDRESS_LINE_2,
VEN_CITY VEN_CITY,
VEN_CNT_COUNTY_CODE VEN_CNT_COUNTY_CODE,
VEN_STC_STATE_CODE VEN_STC_STATE_CODE,
VEN_ZIP_CODE VEN_ZIP_CODE,
VEN_PHONE_NO_1 VEN_PHONE_NO_1,
VEN_PHONE_EXTN_1 VEN_PHONE_EXTN_1,
VEN_PHONE_NO_2 VEN_PHONE_NO_2,
VEN_PHONE_EXTN_2 VEN_PHONE_EXTN_2,
VEN_FAX_NO_1 VEN_FAX_NO_1,
VEN_VENDOR_NO VEN_VENDOR_NO,
VEN_APV_AP_VENDOR_ID VEN_APV_AP_VENDOR_ID,
VEN_EMAIL_ADDRESS VEN_EMAIL_ADDRESS,
--all these should be null
to_number(NULL) PHY_LCN_PARAMETER_ID,
to_char(NULL) PHY_LCN_CURRENT_ADDRESS_IND,
to_char(NULL) PHY_LCN_STATUS_CODE,
to_char(NULL) PHY_LCN_LTY_LOCATION_TYPE,
to_char(NULL) PHY_LCN_ADT_ADDRESS_TYPE,
to_char(NULL) PHY_LCN_HOUSE_NO,
to_char(NULL) PHY_LCN_ADDRESS_LINE_1,
to_char(NULL) PHY_LCN_ADDRESS_LINE_2,
to_char(NULL) PHY_LCN_CITY,
to_char(NULL) PHY_LCN_STC_STATE_CODE,
to_char(NULL) PHY_LCN_ZIP_CODE,
to_char(NULL) PHY_LCN_CNT_COUNTY_CODE,
to_date(NULL) PHY_END_DATE,
to_number(NULL) PHY_LCN_VEN_VENDOR_ID_GTA,
to_char(NULL) PHY_LCN_SUB_LOCATION_GTA,
to_char(NULL) PHY_LCN_DIRECTION_GTA,
---all these should be null
to_char(NULL) LOW_LCN_PARAMETER_ID,
to_char(NULL) LOW_LCN_CURRENT_ADDRESS_IND,
to_char(NULL) LOW_LCN_STATUS_CODE,
to_char(NULL) LOW_LCN_LTY_LOCATION_TYPE,
to_char(NULL) LOW_LCN_ADT_ADDRESS_TYPE,
to_char(NULL) LOW_LCN_HOUSE_NO,
to_char(NULL) LOW_LCN_ADDRESS_LINE_1,
to_char(NULL) LOW_LCN_ADDRESS_LINE_2,
to_char(NULL) LOW_LCN_CITY,
to_char(NULL) LOW_LCN_STC_STATE_CODE,
to_char(NULL) LOW_LCN_ZIP_CODE,
to_char(NULL) LOW_LCN_CNT_COUNTY_CODE,
to_char(NULL) LOW_LCN_LANDLORD,
to_number(NULL) LOW_LCN_LANDLORD_PHONE,
to_date(NULL) LOW_END_DATE,
to_char(NULL) LOW_LCN_SUB_LOCATION_GTA,
to_char(NULL) LOW_LCN_DIRECTION_GTA
FROM LOCATIONS LOC , VENDORS VEN
WHERE LOC.LCN_VEN_VENDOR_ID_GTA IS NOT NULL
AND LOC.LCN_VEN_VENDOR_ID_GTA = VEN_VENDOR_ID
AND LOC.LCN_LTY_LOCATION_TYPE ='AS'
UNION ALL
SELECT
to_char(NULL) VEN_COMPANY_NAME,
to_char(NULL) VEN_COMPANY_NAME_2,
to_char(NULL) VEN_CONTACT_FIRST_NAME,
to_char(NULL) VEN_CONTACT_MIDDLE_NAME,
to_char(NULL) VEN_CONTACT_LAST_NAME,
to_char(NULL) VEN_ADDRESS_LINE_1,
to_char(NULL) VEN_ADDRESS_LINE_2,
to_char(NULL) VEN_CITY,
to_char(NULL) VEN_CNT_COUNTY_CODE,
to_char(NULL) VEN_STC_STATE_CODE,
to_char(NULL) VEN_ZIP_CODE,
to_number(NULL) VEN_PHONE_NO_1,
to_number(NULL) VEN_PHONE_EXTN_1,
to_number(NULL) VEN_PHONE_NO_2,
to_number(NULL) VEN_PHONE_EXTN_2,
to_number(NULL) VEN_FAX_NO_1,
to_char(NULL) VEN_VENDOR_NO,
to_char(NULL) VEN_APV_AP_VENDOR_ID,
to_char(NULL) VEN_EMAIL_ADDRESS,
decode(lcn_adt_address_type,'P',to_number(LCN_PARAMETER_ID),to_number(NULL)) PHY_LCN_PARAMETER_ID,
decode(lcn_adt_address_type,'P',LCN_CURRENT_ADDRESS_IND,to_char(NULL)) PHY_LCN_CURRENT_ADDRESS_IND,
decode(lcn_adt_address_type,'P',LCN_STATUS_CODE,to_char(NULL)) PHY_LCN_STATUS_CODE,
decode(lcn_adt_address_type,'P',LCN_STATUS_CODE,to_char(NULL)) PHY_LCN_LTY_LOCATION_TYPE,
decode(lcn_adt_address_type,'P',LCN_ADT_ADDRESS_TYPE,to_char(NULL)) PHY_LCN_ADT_ADDRESS_TYPE,
decode(lcn_adt_address_type,'P',LCN_HOUSE_NO,to_char(NULL)) PHY_LCN_HOUSE_NO,
decode(lcn_adt_address_type,'P',LCN_ADDRESS_LINE_1,to_char(NULL)) PHY_LCN_ADDRESS_LINE_1,
decode(lcn_adt_address_type,'P',LCN_ADDRESS_LINE_2,to_char(NULL)) PHY_LCN_ADDRESS_LINE_2,
decode(lcn_adt_address_type,'P',LCN_CITY,to_char(NULL)) PHY_LCN_CITY,
decode(lcn_adt_address_type,'P',LCN_STC_STATE_CODE,to_char(NULL)) PHY_LCN_STC_STATE_CODE,
decode(lcn_adt_address_type,'P',LCN_ZIP_CODE,to_char(NULL)) PHY_LCN_ZIP_CODE,
decode(lcn_adt_address_type,'P',LCN_CNT_COUNTY_CODE,to_char(NULL)) PHY_LCN_CNT_COUNTY_CODE,
decode(lcn_adt_address_type,'P',END_DATE,to_char(NULL)) PHY_END_DATE,
decode(lcn_adt_address_type,'P',LCN_VEN_VENDOR_ID_GTA,to_char(NULL)) PHY_LCN_VEN_VENDOR_ID_GTA,
decode(lcn_adt_address_type,'P',LCN_SUB_LOCATION_GTA,to_char(NULL)) PHY_LCN_SUB_LOCATION_GTA,
decode(lcn_adt_address_type,'P',LCN_DIRECTION_GTA,to_char(NULL)) PHY_LCN_DIRECTION_GTA,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_PARAMETER_ID,to_char(NULL)) LOW_LCN_PARAMETER_ID,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_CURRENT_ADDRESS_IND,to_char(NULL)) LOW_LCN_CURRENT_ADDRESS_IND,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_STATUS_CODE,to_char(NULL)) LOW_LCN_STATUS_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_LTY_LOCATION_TYPE,to_char(NULL)) LOW_LCN_LTY_LOCATION_TYPE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ADT_ADDRESS_TYPE,to_char(NULL)) LOW_LCN_ADT_ADDRESS_TYPE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_HOUSE_NO,to_char(NULL)) LOW_LCN_HOUSE_NO,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ADDRESS_LINE_1,to_char(NULL)) LOW_LCN_ADDRESS_LINE_1,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ADDRESS_LINE_2,to_char(NULL)) LOW_LCN_ADDRESS_LINE_2,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_CITY,to_char(NULL)) LOW_LCN_CITY,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_STC_STATE_CODE,to_char(NULL)) LOW_LCN_STC_STATE_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ZIP_CODE,to_char(NULL)) LOW_LCN_ZIP_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_CNT_COUNTY_CODE,to_char(NULL)) LOW_LCN_CNT_COUNTY_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_LANDLORD,to_char(NULL)) LOW_LCN_LANDLORD,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_LANDLORD_PHONE,to_char(NULL)) LOW_LCN_LANDLORD_PHONE,
decode(LCN_ADT_ADDRESS_TYPE,'D',END_DATE,to_char(NULL)) LOW_END_DATE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_SUB_LOCATION_GTA,to_char(NULL)) LOW_LCN_SUB_LOCATION_GTA,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_DIRECTION_GTA,to_char(NULL)) LOW_LCN_DIRECTION_GTA
FROM LOCATIONS LOC
WHERE (LCN_LTY_LOCATION_TYPE ='AS' OR LCN_ADT_ADDRESS_TYPE='D')
AND LCN_CURRENT_ADDRESS_IND ='Y'
thanks -
Merge two rows & show in a single row in table results
Hi, I need to merge 2 rows having 3 columns in a single row in table view
The cols are currently shown as :
Project NO-------(Current_Month) Revenue----------(Prior_Month) Revenue
123123 10000
20000
Revenue is a single column with revenue for diffreent Period.
10000 is for May
20000 is for April
Project NO for both are same, just the periods are different. if I am not displaying Period i need to merge the 2 rows & show as
Project NO-------(Current_Month) Revenue----------(Prior_Month) Revenue
123123 10000 20000
Please let me know how we can acheive this??
thanx
Pankaj123123 is the project number..
the above is not getting displayed properly....as the blank spaces are removed...
Please consider this -
Merging two rows based on a sequence_number
Hi all
Suppose that I have a table with the following structure:
UserID NUMBER PK
SequenceID NUMBER NOT NULL
Value1 NUMBER NULL
Value2 VARCHAR2 NULL
Value3 DATE NULL
And, this table, is populated as examplified below:
UserID SequenceID Value1 Value2 Value3
1 1 10 NULL 'TEST'
1 2 15 NULL 01/01/2011
1 3 NULL 'TEST2' 02/01/2011
2 4 20 NULL NULL
2 5 12 'ABC' NULL
2 6 NULL 'AB' NULL
What I want to do is merge these rows, "grouping" then by UserID (That is the PK), on a way that the last major sequence ID always takes precedence from the previous one... So, the query should returns something like:
UserID SequenceID Value1 Value2 Value3
1 3 15 'TEST2' 02/01/2011
2 6 12 'AB' NULL
Explanations:
As you can see, for each UserID, I´d like to get a row with the last filled value for each columns...
I can´t use the MAX function because, to UserID 2, I will get unexpected values on column Value2 (I would get 'ABC' insted of 'AB') and column Value1 (I would get 20 instead of 12).
How is the best way (best performance) to archieve this?
Thanks a lot!!!Hi,
Maybe this will help:
select userid,
max(sequenceid) keep (dense_rank last order by sequenceid) sequenceid,
max(value1) keep (dense_rank last order by case when value1 is not null then sequenceid end nulls first) value1,
max(value2) keep (dense_rank last order by case when value2 is not null then sequenceid end nulls first) value2,
max(value3) keep (dense_rank last order by case when value3 is not null then sequenceid end nulls first) value3
from t
group by userid;Sample execution:
SQL> with t as (
2 select 1 userid, 1 sequenceid, 10 value1, NULL value2, 'TEST' value3 from dual union all
3 select 1, 2, 15, NULL, '01/01/2011' from dual union all
4 select 1, 3, NULL, 'TEST2', '02/01/2011' from dual union all
5 select 2, 4, 20, NULL, NULL from dual union all
6 select 2, 5, 12, 'ABC', NULL from dual union all
7 select 2, 6, NULL, 'AB', NULL from dual
8 ) -- end of test data
9 select userid,
10 max(sequenceid) keep (dense_rank last order by sequenceid) sequenceid,
11 max(value1) keep (dense_rank last order by case when value1 is not null then sequenceid end nulls first) value1,
12 max(value2) keep (dense_rank last order by case when value2 is not null then sequenceid end nulls first) value2,
13 max(value3) keep (dense_rank last order by case when value3 is not null then sequenceid end nulls first) value3
14 from t
15 group by userid;
USERID SEQUENCEID VALUE1 VALUE2 VALUE3
1 3 15 TEST2 02/01/2011
2 6 12 AB You can take the result of this SQL and populate the new version of table with an Insert .. Select statement.
Edited by: fsitja on Feb 25, 2011 2:57 PM Fixed it and removed test code that went "live" by mistake -
In Web Dynpro ABAP, Can we merge two cells of a row in a table ?
In Web Dynpro ABAP, Can we merge two cells of a row in a table ?
Hallo Jagannatha,
the new table feature is available in SAP NetWeaver 7.0 EhP2 (SAP ERP 6.0 EhP5, SAP Business Suite 7i2010) named 'TableMultiEditorCell'. See [SAP Online Help|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/9b/46bb0d339b42cc8d30636ca0c9f5b6/frameset.htm] for more details ...
"This UI element is a table cell variant that enables several UI elements to be placed in one table cell. This type of cell can be used for "one click actions". ...
Regards, Bertram -
Showing report data columns into two rows instead of one row using SSRS 2012
Hi All,
I have a ssrs report with 13 columns and I want to show those 13 columns data into two rows instead of showing in one row. please send me step by step process.
id fullname firstname lastname mailingaddress billingaddress
city state zipcode
1 ABC A C
xyz xyz123 york
PA 12345
homephone cellphone workphone company
1234567890 4567890123 0123456789 ABC,Inc
id fullname firstname lastname mailingaddress billingaddress
city state zipcode
2 XYZ X Z
abc abc123 lewisburg
PA 54321
homephone cellphone workphone company
4567890123 0123456789 1234567890 xyz,Inc
id fullname firstname lastname mailingaddress billingaddress
city state zipcode
3 BCD B D
123abc xyz123 leesburg PA
54123
homephone cellphone workphone company
4567895623 0783456789 1238967890 Hey,Inc
Thanks in advance,
RH
sqlDo a right mouse click on the left, gray row marker => "Insert Row"=> "Inside Group
- Above or Below", then you get a second detail row.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Dimension variable shows two rows in Webi report
Hello everyone!
I want to build a report with the following structure:
Account group 1 | KYF 1| KYF 2
For this effect, I've created a dimension variable called "Account group 1" with a formula like "GL account starts with "64"".
With this I'm getting two rows: one with the correct value and another with the aggregated value of the remaining accounts.
How can I make this return only one row with the restricted values I want?
Best Regards,
Luís Andrade.Hi Luis,
There are two ways to do it.
1. Simplest solution use a report filter by selecting the Account Group column and selecting the accounts.
2. If the above one doesn't work if the report refreshes and new accounts come in, the other way is create one more variable named group2 or something, as dimension and use an if statement where if account group = account starting with GL Then group1 Else NULL. now apply the report filter where group2 not equal to "NULL". Now you will not have the last row as before.
I think one of this should be helpful.
Thanks,
Rajesh -
BI Report is showing two rows for a single record
Dear Experts
This is Raja
I am Facing one issue in BI Report,
I have created report based on a Infocube which is getting data from two DSO. one is Standard [ Billing Condition Data]and another one is ZDSO[Targets}. these two requests go in the Infocube
1. Budget- zdbudget [DSO]
2.Actuals -0sd_o06 [DSO]
I need to make report Like this :For a specific period
EX:1
Material Sold to party Actual Budget/Target Variance Actual YTD Budget YTD
M100 S100 21 30 10 21 30
here budget{ Budget DSO} values i am getting Material wise sold to party is not coming through file. But for Actual values sold to party is coming, that's why my report is showing like this..
Ex:2
Material Sold to party Actual Budget/Target Variance Actual YTD Budget YTD
M100 S100 21 10 21
30 -30 30
Since the sold to party is not available in Budget DSO in the report For Every Material it's showing Two Rows.
How can bring this in to one Line..Like EX:1
Please give Valuable Suggestions..Say the data is like this.
Material Sold to Party Act Bud
M1 S1 100 0
M1 # 0 50
M1 S2 200 0
And you want to see like below.
Material Sold to Party Act Bud
M1 S1 100 50
M1 S2 200 50
If this is your requirement, let the sold to party be in Rows.
In columns, for budget, create a local selection, drag budget kf, sold to party (restrict this by # and right click and choose constant selection). This makes the budget kf independent of what is coming in the rows and always shows data corresponding to sold to party #. Hope this is clear. -
Report two rows for a given group item
All,
I need to generate a report that will list credits on one line and related debits on the next line. Kind of like the following:
Account Name_____Amount
Cash ................. 1000.00 ...... (this line would reflect positive entries, or deposits)
Cash .................... 20.00 - ...... (this line would reflect the negative entries, or withdrawls)
Is there an easy way to do something like this?
We're running the desktop edition of Discoverer 10g.
Thanks,
Gary F.Hi Rod,
The plot thickens...
The report I'm working on will read through a table of invoiced items, much like the following:
Bill_Charges Table
Company
Year
Month
Week
Bill_Code
Retail_Amount
Discount_Amount
Based on the Bill_Code, I need to aggregate the Retail_Amount, and the Discount_Amount.
The data can look like this:
ABC Company, 2009,08,01,102,100.00,10
ABC Company, 2009,08,01,103,90.00,15
ABC Company, 2009,08,01,104,100.00,5
ABC Company, 2009,08,01,105,100.00,5
The report will then need to report two rows for all Bill_Codes in the 100s range, first the Retail_Amount, and then the Discount_Amount directly below it, in the next row, as seen below:
Company Name . . . . . . .Billed Amounts
ABC Company................$390.00 (This would be the sum of the Retail_Amount column)
.................................. $35.00 (this would be the sum of the Discount_Amount column)
My gut feeling is that this will need to be a pivot table, but I'm so rusty on pivot tables that I'd need more than just a squirt can to limber me up.
Any help you can throw my way would be greatly appreciated.
Thanks for all you do for us,
Gary F. -
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 -
Need to merge the below two rows
Hi,
I have a sample data as shown below:
ID OBJID ACT_CODE ADDNL_INFO ENTRY_TIME
2523540 333003736 900 from WIP default to Queue PSD1. 1/3/2012 15:07
2523540 333003271 100 100 from Queue PSD1 to WIP For assigment. 1/3/2012 15:43
2523540 333003744 900 900 from WIP default to Queue PSD1. 1/3/2012 15:49
2523540 333004966 100 100 from Queue PSD1 to WIP For assigment. 1/3/2012 16:04
I need to merge the first two rows and get a single record for each "from" and "to" as shown below (desired output)
ID_NUMBER ADDNL_INFO ENTRY_TIME EXIT_TIME TOTAL TIME
2523540 PSD1 1/3/2012 15:07 1/3/2012 15:43 0.025069444
2523540 PSD1 1/3/2012 15:49 1/3/2012 16:04 0.010231481
I have used function on the addnl_info column to display only the name of the queue "PSD1"
(SUBSTR(ADDNL_INFO, INSTR(ADDNL_INFO, 'PSD1'), LENGTH('PSD1'))) QUEUE_NAME
Can any one help me out in getting the desired output.Below is a solution to your query:
drop table test_Table;
create table test_Table
ID number,
objid number,
act_code number,
addl_info varchar2(500),
entry_time timestamp
insert into test_Table values (2523540, 333003736, 900, 'from WIP default to Queue PSD1.', to_timestamp('1/3/2012 15:07', 'DD/MM/YYYY HH24:MI'));
insert into test_Table values (2523540, 333003271, 100, 'from Queue PSD1 to WIP For assigment.', to_timestamp('1/3/2012 15:43', 'DD/MM/YYYY HH24:MI'));
insert into test_Table values (2523540, 333003744, 900, 'from WIP default to Queue PSD1.', to_timestamp('1/3/2012 15:49', 'DD/MM/YYYY HH24:MI'));
insert into test_Table values (2523540, 333004966, 100, 'from Queue PSD1 to WIP For assigment.', to_timestamp('1/3/2012 16:04', 'DD/MM/YYYY HH24:MI'));
select * from test_table;
select id, addl_info, entry_time, exit_time, total_time
from
select a.id, a.objid, 'PSD1' addl_info, a.entry_time, lead(a.entry_time, 1, null) over (order by a.entry_time) exit_time,
lead(a.entry_time, 1, null) over (order by a.entry_time) - a.entry_time total_time, DECODE(a.act_code, 900, 'D', 'ND') disp
from test_Table a
where a.id = 2523540
where disp = 'D';
ID ADDL_INFO ENTRY_TIME EXIT_TIME TOTAL_TIME
2523540 PSD1 01-MAR-12 03.07.00.000000000 PM 01-MAR-12 03.43.00.000000000 PM 0 0:36:0.0
2523540 PSD1 01-MAR-12 03.49.00.000000000 PM 01-MAR-12 04.04.00.000000000 PM 0 0:15:0.0I see a shortcoming in the design:
1. For "WIP default to Queue PSD1" there are two records, both containing different OBJID but same ID, which in ideal case should not happen. You MUST have a COMPOSITE key on ID and OBJID; This shall help you to identify the distinct records.
My solution is not perfect as it is based on the ENTRY TIME. The reason being SIMPLE Ordering by the OBJID would not lead to a correct difference in the Transaction Time (referred by you as TOTAL_TIME.); Hence, for this reason I had to use ENTRY_TIME to correctly get the total_time.
If you wish you may follow the solution else I shall always recommend to change the Table Design and follow the correct approach.
If you are changing the Table design then following shall be a solution:
select id, addl_info, entry_time, exit_time, total_time
from
select a.id, a.objid, 'PSD1' addl_info, a.entry_time, lead(a.entry_time, 1, null) over (order by a.id, a.objid) exit_time,
lead(a.entry_time, 1, null) over (order by a.entry_time) - a.entry_time total_time, DECODE(a.act_code, 900, 'D', 'ND') disp
from test_Table a
where disp = 'D';Regards,
P. -
Report generating two rows for the very first record
Hi ,
I have designed a simple RTF template using Table Wizard in MS Words.When I am trying to view the report in excel , the report shows two entries for first record.The problem is with first record only and other entries displyed are fine.When I tried deleting the first record , the next record is showing two rows.
Am I missing something here ?
Please advice.
Thanks!!Hi ,
I got this sorted out.The pbm was with my XML as My Rowset and Row had the same name.I changeed the rowset name and it worksfine now.
Thanks Vetsrini!!
Maybe you are looking for
-
I brought up my itunes through a friends laptop. I signed out thinking I could get on my home computer and still have my iTunes accessible, how do i access them from this computer? HELP
-
Itunes wont install..mobile device error.
I'm running Windows 7 64bit, when I tried to update the current patch to itunes it messed up everything associated. Uninstalled, deleted folders etc. and then tried to reinstall, it gets to starting services and then error pops up stating it cant i
-
Is it ok to use your ipad mini while carging
Can you use your ipad mini while carging
-
Someone help please!!!!!
can someone explain why only some of my dvds will play on my macbook? sometimes i get the "not permitted" message, other times it says "no supported disc" or something. Or if it doesnt say any of this it just ejects my dvd. Any thoughts anybody?
-
Can't get show/hide event of child UI Component to fire
I have 4 UI Components, each one inside the other (nested). If the "hide" event of Component 1 is fired, I'm expecting the other components hide events to also fire, but they don't. So for example: + Component 1 +> Component 2 ++> Component 3 +++> Co