Combine fillable rows
I'm trying to create a fillable form from an existing Excel document. In the Excel document, I left two rows of space for the end user's response. Now that it is in PDF, these rows for the response do not wrap the text. Is it possible to combine the rows/fields or wrap text?
Thanks!
thanks. is there something else that i need to do? even with multiline selected, it's still just skrinking the text instead of allowing for another line. does the formatting in excel have something to do with it?
Similar Messages
-
Hi,
How do I combine 2 rows in a table to get a single row.
Here is the Query and Output
Query:
SELECT ALL T.TEAM_ID, T.TEAM_NAME, T.TEAM_LEADER_NAME, TD.AUG_EMP_TRNED, TD.AUG_TOTAL_EMP,
TD.SEP_EMP_TRNED, TD.SEP_TOTAL_EMP FROM TEAM T, TRNG_DETAILS TD WHERE T.TEAM_ID = TD.TEAM_ID
AND TD.TRNG_FREQUENCY ='Monthly' AND TD.TEAM_ID = 3
Result:
Row TEAM_ID TEAM_NAME TEAM_LEADER_NAME AUG_EMP_TRNED AUG_TOTAL_EMP SEP_EMP_TRNED SEP_TOTAL_EMP
1 3 ABCv gg (null) (null) 8 8
2 3 ABCv gg 12 12 (null) (null)
I want to get this result in one row with all values ........
Thanks in advanceAssuming your goal is to pick the non-NULL value...
SELECT team_id, team_name, team_leader_name, max(aug_emp_trned), max(aug_total_emp), ...
FROM (<<your query>>)
GROUP BY team_id, team_name, team_leader_nameIf by combining the rows you ean something else (i.e. taking a SUM), you would change the MAX call above to a SUM
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
How to combine many rows into one row
Hi all,
I have a question regarding to how to combine many rows into one row?
My result set is like that:
ITEM_NO NAME1
11 abc
11 cde
11 fg
Want to combine them into
ITEM_NO NAME1
11 abc;cde;fg
would anybody can tell me how to do that? Thanks
RayYou can check this --
satyaki>
satyaki>
satyaki>create table t
2 as
3 select 11 ITEM_NO, 'abc' NAME1 from dual
4 union all
5 select 11 ITEM_NO, 'cde' NAME1 from dual
6 union all
7 select 11 ITEM_NO, 'fg' NAME1 from dual;
Table created.
satyaki>
satyaki>
satyaki>
satyaki>set lin 10
satyaki>
satyaki>desc t;
Name Null? Type
ITEM_NO NUMBER
NAME1 VARCHAR2(3)
satyaki>
satyaki>
satyaki>set lin 1000
satyaki>
satyaki>
satyaki>
satyaki>SELECT ITEM_NO,
2 LTRIM(MAX(SYS_CONNECT_BY_PATH(NAME1,';'))
3 KEEP (DENSE_RANK LAST ORDER BY curr),';') AS NAME1_DET
4 FROM (SELECT ITEM_NO,
5 NAME1,
6 ROW_NUMBER() OVER (PARTITION BY ITEM_NO ORDER BY NAME1) AS curr,
7 ROW_NUMBER() OVER (PARTITION BY ITEM_NO ORDER BY NAME1) -1 AS prev
8 FROM t)
9 GROUP BY ITEM_NO
10 CONNECT BY prev = PRIOR curr AND ITEM_NO = PRIOR ITEM_NO
11 START WITH curr = 1;
ITEM_NO NAME1_DET
11 abc;cde;fgRegards.
Satyaki De. -
Combine multiple rows in single row
I am new to SQL server and i am trying to combine multiple row in single row but i am not able to do it.Can anyone help me out?
Input :
Id |RED |BUY |BSW
1328 NULL NULL 0.05
1328 NULL 0.06 NULL
1328 0.01 NULL NULL
1328 0.05 NULL NULL
1329 NULL NULL 0.05
1329 NULL 0.05 NULL
1329 0.05 NULL NULL
Output
Id |RED |BUY |BSW
1328 0.01 0.06 0.05
1328 0.05 NULL NULL
1329 0.05 0.05 0.05Actually I am consolidating above result into text file and sending it to external system.Main aim is to remove NULL values and arrange the data as expected output.
Also expected output can be
Id |RED
|BUY |BSW
1328 0.05
0.06 0.05
1328 0.01
NULL NULL
Or
Id |RED
|BUY |BSW
1328 0.01
0.06 0.05
1328 0.05
NULL NULL
for Id= 1328. -
How to combine many rows into 1 rows in 1 column?
Hi all,
I have a question regarding to how to combine many rows into one row?
My result set is like that:
ITEM_NO NAME1
11 abc
11 cde
11 fg
Want to combine them into
ITEM_NO NAME1
11 abc;cde;fg
would anybody can tell me how to do that? Thanks
RayHi,
select * from x2;
INO NAME
13 PQR
11 ABC
11 DEF
12 JKL
12 MNO
11 GHI
select p.ino as ITEMNO,
substr(max(substr(sys_connect_by_path (p.name,';'),2)),1,60) as ITEMNAME
from (select ino,name,
row_number()over (partition by ino order by ino, name) rn
from x2) p
start with p.rn = 1
connect by p.rn = prior p.rn + 1
and prior p.ino = p.ino
group by ino;
OP
ITEMNO ITEMNAME
11 ABC;DEF;GHI
12 JKL;MNO
13 PQR cheers
Nirmal -
Sql Query : Sum , all the possible combination of rows in a table
SQL Server 2008 R2
Sample Table structure
create table TempTable
ID int identity,
value int
insert into TempTable values(6)
insert into TempTable values(7)
insert into TempTable values(8)
insert into TempTable values(9)
insert into TempTable values(10)
I actually want something like below,
that It returns rows such that, it has the sum of all the remaining rows , as shown below.
I will ignore the repeated rows.
6+7
6+8
6+9
6+10
6+7+8
6+7+9
6+7+10
6+8+9
6+8+10
6+9+10
6+7+8+9
6+7+8+9+10This makes no sense. What about NULLs? What about duplicate values? You have rows, so you have many combinations. We know that this set totals to 39, so there is no subset totals to half of any odd number. 19.5
in this case.
None of your examples are
even close!
6+7 = 13
the remaining rows 8+9+10 = 27, so you failed!
Want to try again?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Combining fillable pdfs leads to issue
I created a fillable pdf in Acrobat a while ago and extended features in Adobe Reader to create it. I created another fillable pdf months later the same way. And then I decided to merge the two because I needed them to be together. I highlighted both forms (the forms that were the result of extending features to Adobe Reader) and the combined form has a purple bar at the top stating "Click 'Sign' to fill out and sign this form. When you are done, you can save a copy by clicking 'Done Signing'." Why is this? Clients can no longer fill the form out and save it like they used to. They now must sign it and then it becomes uneditable after Save As.
Both files used for this merge open in Reader and allow the user to fill out the form and save data typed into the form. But once I merge the two, this is no longer the case. Also, there are no signature fields in either document.
Acrobat 9.5.4
Reader 10.1.6You should simply re-enable the new PDF that you created and that message and ability to sign that way will go away.
-
I have result of a query as :
emp_id emp_name wife_1 wife_2 wife_3
12 abc xx
12 abc yy
34 xyz tt
34 xyz pp
34 xyz uu
I want to combine these reords so that the result should be like this :
emp_id emp_name wife_1 wife_2 wife_3
12 abc xx yy
34 xyz tt uu pp
This is what I explained easily. Now in my query i have used DECODE 3 times as
DECODE (SEDT2.CDT_ROLE_CD, 'smart', spouse_table.wife, null) as wife_1,
DECODE (SEDT2.CDT_ROLE_CD, 'ugly', spouse_table.wife, null) as wife_2,
DECODE (SEDT2.CDT_ROLE_CD, 'MARSHUS_ROLE_SP', spouse_table.wife, null) as wife_3,
When I removed these decode statements the result is as :
emp_id emp_name
12 abc
34 xyz
Why the decode statements giving me problem?
Due to bussiness policy of my employeer, I can not post my actual query here.
I know , without knowing query , to figure out the cause is diffcult, but still any help , clue in this scenario is appriciable.
Thankx in advanceSQL>
SQL> drop table test_table
2 /
Table dropped.
SQL>
SQL> create table test_table(emp_id number, ename varchar2(32), wife varchar2(32))
2 /
Table created.
SQL> INSERT into test_table values(12, 'abc', 'xx')
2 /
1 row created.
SQL> INSERT into test_table values(12, 'abc', 'yy')
2 /
1 row created.
SQL> INSERT into test_table values(34, 'xyz', 'tt')
2 /
1 row created.
SQL> INSERT into test_table values(34, 'xyz', 'pp')
2 /
1 row created.
SQL> INSERT into test_table values(34, 'xyz', 'uu')
2 /
1 row created.
SQL>
SQL>
SQL> select emp_id
2 , ename
3 , max(decode(r, 1, wife, null)) wife_1
4 , max(decode(r, 2, wife, null)) wife_2
5 , max(decode(r, 3, wife, null)) wife_3
6 from(select emp_id, ename, wife,row_number() over (partition by emp_id order by ename) r
7 from test_table)
8 group by emp_id, ename
9 /
EMP_ID ENAME WIFE_1 WIFE_2 WIFE_3
12 abc xx yy
34 xyz tt pp uu
SQL>
SQL> spool off -
Exclude or combine duplicate rows
Hoping to get some help on this.
I have been trying to find a way to combine Dep. and Arriv. columns without losing the unique values.
Unfortunately, I do not have a time stamp for each column (which would make things much easier).
The only distinguishing value is in Dep. column.
Pr. Dep. Arriv.
1 ORY LHR
1 LHR ORY
2 GOT LOS
2 LOS GOT
3 CDG IST
3 IST CDG
4 YYC FRA
4 HRE YYC
5 BLR GOI
5 GOI BLR
6 CDG IST
6 IST CDG
The result that I am trying to accomplish is:
Option 1) -Combining the columns and grouping by Pr.
Pr. Dep.-Arriv.
1 ORY - LHR - ORY
2 GOT - LOS - GOT
3 CDG - IST - CDG
4 YYC - FRA - HRE - YYC
Option 2) -Ignoring the duplicate row based on the dep. arriv. value
Pr. Dep. Arriv.
1 ORY LHR
2 GOT LOS
3 CDG IST
4 YYC FRAHi,
Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data. Since you're new in the forum, I did it for you:
CREATE TABLE table_x
( pr NUMBER
, dep VARCHAR2 (3)
, arriv VARCHAR2 (3)
INSERT INTO table_x (pr, dep, arriv) VALUES (1, 'ORY', 'LHR');
INSERT INTO table_x (pr, dep, arriv) VALUES (1, 'LHR', 'ORY');
INSERT INTO table_x (pr, dep, arriv) VALUES (2, 'GOT', 'LOS');
INSERT INTO table_x (pr, dep, arriv) VALUES (2, 'LOS', 'GOT');
INSERT INTO table_x (pr, dep, arriv) VALUES (3, 'CDG', 'IST');
INSERT INTO table_x (pr, dep, arriv) VALUES (3, 'IST', 'CDG');
INSERT INTO table_x (pr, dep, arriv) VALUES (4, 'YYC', 'FRA');
INSERT INTO table_x (pr, dep, arriv) VALUES (4, 'HRE', 'YYC');
INSERT INTO table_x (pr, dep, arriv) VALUES (5, 'BLR', 'GOI');
INSERT INTO table_x (pr, dep, arriv) VALUES (5, 'GOI', 'BLR');
INSERT INTO table_x (pr, dep, arriv) VALUES (6, 'CDG', 'IST');
INSERT INTO table_x (pr, dep, arriv) VALUES (6, 'IST', 'CDG');Explain, with specific exampels, how you get the results you want from the given data.
If you would be satisfied with different outputs, give a couple of examples and explain.
Always say which version of Oracle you're using.
In either case, you want one row per pr; that sounds like a job for GROUP BY pr.
Option 1:
WITH got_path AS
SELECT pr
, CONNECT_BY_ROOT dep || SYS_CONNECT_BY_PATH ( arriv
) AS path
, LEVEL AS lvl
FROM table_x
WHERE CONNECT_BY_ISLEAF = 1
CONNECT BY NOCYCLE pr = PRIOR pr
AND arriv = PRIOR dep
SELECT pr
, MIN (path) KEEP (DENSE_RANK LAST ORDER BY lvl) AS dep_arriv
FROM got_path
GROUP BY pr
ORDER BY pr;Output:
` PR DEP_ARRIV
1 LHR - ORY - LHR
2 GOT - LOS - GOT
3 CDG - IST - CDG
4 YYC - FRA - YYC
5 BLR - GOI - BLR
6 CDG - IST - CDGI know this isn't quite what you requested. I'm not sure what you want.
Option 2:
SELECT pr
, MAX (dep) AS dep
, MAX (arriv) KEEP (DENSE_RANK LAST ORDER BY dep)
AS arriv
FROM table_x
GROUP BY pr
ORDER BY pr
;Output:
` PR DEP ARR
1 ORY LHR
2 LOS GOT
3 IST CDG
4 YYC FRA
5 GOI BLR
6 IST CDGWhy don't you want output for pr>=5?
What would you want if there were 3 (or more) rows with the same pr? What if rows with the same pr have nothing else in common? If these things are possible, include exampels in your sample data and resutls. -
Combining multiple rows to singe row thru SQL Stmt
Hello,
I am trying to combine values returned from multiple row into one row,
thru inner/outer sql or any optimal way.
In the example i would like to have First name, Last name, email and phone to be
returned as a single row.
create table TEMP_AAAAA
FIRST_NAME VARCHAR2(25),
LAST_NAME VARCHAR2(25),
CON_METHOD VARCHAR2(25),
CON_VALUE VARCHAR2(25)
INSERT INTO TEMP_AAAAA VALUES('TOM','MAC','EMAIL','[email protected]');
INSERT INTO TEMP_AAAAA VALUES('TOM','MAC','PHONE','12345');Any suggestion in doing it thru sql stmt.
I have done this thru pl/sql, wondering if this could be achieve thru single SQL Stmt
DECLARE
v_FIRST_NAME VARCHAR2(25);
v_SECOND_NAME VARCHAR2(25);
v_EMAIL VARCHAR2(25);
v_PHONE VARCHAR2(25);
BEGIN
v_FIRST_NAME := NULL;
v_SECOND_NAME := NULL;
v_EMAIL := NULL;
v_PHONE := NULL;
FOR IMPL_CUR IN(SELECT * FROM TEMP_AAAAA ORDER BY CON_METHOD DESC)
LOOP
IF v_FIRST_NAME IS NULL
THEN
v_FIRST_NAME := IMPL_CUR.FIRST_NAME;
END IF;
IF v_SECOND_NAME IS NULL
THEN
v_SECOND_NAME := IMPL_CUR.LAST_NAME;
END IF;
IF v_PHONE IS NULL AND IMPL_CUR.CON_METHOD = 'PHONE'
THEN
v_PHONE := IMPL_CUR.CON_VALUE;
END IF;
IF v_FIRST_NAME = IMPL_CUR.FIRST_NAME AND
v_SECOND_NAME = IMPL_CUR.LAST_NAME AND
length(v_PHONE) > 0
THEN
IF v_EMAIL IS NULL AND IMPL_CUR.CON_METHOD = 'EMAIL'
THEN
v_EMAIL := IMPL_CUR.CON_VALUE;
EXIT;
END IF;
END IF;
END LOOP;
DBMS_OUTPUT.put_line('firstName...:' || v_FIRST_NAME);
DBMS_OUTPUT.put_line('lastName....:' || v_SECOND_NAME);
DBMS_OUTPUT.put_line('PHONE.......:' || v_PHONE);
DBMS_OUTPUT.put_line('EMAIL.......:' || v_EMAIL);
END;Hi Ludy,
Following query should work -
P.S. - I have added records for one more person with first name as 'TOM1' and last name as 'MAC1' for testing purpose. Given inserts for these 2 records as well.
Connected to Oracle Database 11g Release 11.2.0.1.0
SQL>
SQL> INSERT INTO TEMP_AAAAA VALUES('TOM1','MAC1','EMAIL','[email protected]');
1 row inserted
SQL> INSERT INTO TEMP_AAAAA VALUES('TOM1','MAC1','PHONE','12345');
1 row inserted
SQL>
SQL>
SQL> SELECT t.first_name
2 ,t.last_name
3 ,MAX(decode(t.con_method, 'PHONE', t.con_value, NULL)) phone
4 ,MAX(decode(t.con_method, 'EMAIL', t.con_value, NULL)) email
5 FROM temp_aaaaa t
6 GROUP BY t.first_name
7 ,t.last_name
8 /
FIRST_NAME LAST_NAME PHONE EMAIL
TOM MAC 12345 [email protected]
TOM1 MAC1 12345 [email protected]
SQL> Hope this helps.
Cheers,
- Anirudha
Edited by: Anirudha Dhopate on Nov 10, 2011 9:12 PM -
Combine 2 rows into single row?
I have a table A which has information related to a process. For process completion there exist 2 rows. One has in it the total elapsed time, the time the entire process (which is multipart) begin and end time, but the columns related to rows processed are blank. Another related row has a start, end and elapsed time in it -- which I don't want -- but it has the row counts that I do want.
I want to take these 2 rows, combine the relevant information into 1 row and insert that row into table B.
I know I could insert from the first row and then come back and update it from the second row, but I hate having to read Table A twice. Any suggestions?Hello
Is it not just a matter of using group by with sum? I may well have missed an important detail but here's a starting point:
SQL> CREATE TABLE DT_TEST_PROCESS
2 ( id number,
3 stage number,
4 rows_processed number,
5 elapsed number
6 )
7 /
Table created.
SQL>
SQL> INSERT INTO dt_test_process
2 VALUES(1,1,100,0)
3 /
1 row created.
SQL> INSERT INTO dt_test_process
2 VALUES(1,2,0,10)
3 /
1 row created.
SQL> INSERT INTO dt_test_process
2 VALUES(2,1,1000,0)
3 /
1 row created.
SQL> INSERT INTO dt_test_process
2 VALUES(2,2,0,20)
3 /
1 row created.
SQL>
SQL> INSERT INTO dt_test_process
2 VALUES(3,1,500,0)
3 /
1 row created.
SQL> INSERT INTO dt_test_process
2 VALUES(3,2,0,30)
3 /
1 row created.
SQL>
SQL> SELECT
2 id,
3 SUM(rows_processed) total_rows,
4 SUM(elapsed) total_elapsed
5 FROM
6 dt_test_process
7 GROUP BY
8 id
9 /
ID TOTAL_ROWS TOTAL_ELAPSED
1 100 10
2 1000 20
3 500 30
SQL>
SQL> CREATE TABLE dt_test_process_sum AS
2 SELECT
3 id,
4 SUM(rows_processed) total_rows,
5 SUM(elapsed) total_elapsed
6 FROM
7 dt_test_process
8 GROUP BY
9 id
10 /
Table created.HTH
David -
Combining/ merging rows in PowerPivot
Hi,
Currently what happens is when I create a Pivot Table based on the first table I get count for ABC10 as 2, but ideally it should be 1. I want to combine Sub Bill Type if BILL NO and BILL TYPE is same. Ideally second row shouldn't be considered into calculation,
but should include SUB BILL TYPE.
Is there any formula to achieve this?
I am not a query expert, so no idea if it's possible using query. Recently I am using this query.
SELECT AL1.BILL_NO as "Bill No", AL1.REF_NO as "Ref No", AL1.REF_MOD as "Reference Module",
AL1.STATUS "Bill Status", AL1.PAYER_NAME as "Payer Name", AL1.BILLING_DT as "Billing Date",
AL1.DUE_DT as "Due Date", AL1.ID_TYPE as "ID Type", AL1.ID_NO as "ID No",
AL1.REMARKS as "Remarks", AL4.FEELIST_ID as "FeeList ID",
AL4.FEE_ID as "Fee ID", AL4.QUANTITY as "Quantity", AL4.GST_AMT as "GST Amount",
AL4.GST_ABSORBED as "GST Absorbed", AL4.SUBTOTAL as "Sub Total", AL3.BILL_TYPE as "Bill Type",
AL3.SUBBILL_TYPE as "Sub Bill Type", AL3.AMOUNT as "Amount", AL2.PAY_ID as "Pay ID",
AL2.PAYMENT_MODE as "Payment Mode", AL2.PAY_STATUS "Pay Status",
AL2.CHQ_ID as "Cheque ID", AL2.RECEIPT_NO as "Receipt No", AL2.COLLECTION_CTR as "Collection Centre",
AL2.PAYMENT_DT as "Payment Date", AL2.PAID_AMOUNT as "Paid Amount",
AL2.TRANS_DT as "Transaction Date", AL5.WORKPLACE_NAME as "Workplace Name"
FROM BIL_BILL AL1, BIL_PAY AL2, BIL_BILLING_FEE AL3, BIL_FEELIST AL4, LIC_WP_DET AL5
WHERE (AL1.BILL_NO = AL4.BILL_NO (+) AND AL1.REF_NO = AL5.WORKPLACE_NO (+) AND
AL1.BILL_NO=AL2.BILL_NO AND AL4.FEE_ID=AL3.FEE_ID) AND (AL2.PAY_STATUS='PD' AND
AL1.DELETE_IND='F' AND AL2.DELETE_IND='F')
Thanks,
SSHi ,
Please check out the below link for the solution in Power Pivot
Group Multiple Rows to Single Delimited Row in PowerPivot
For achieving this in SQL , check the below link. This will work for SQL server. But your query looks like Oracle one.
TSQL – Concatenate Rows using FOR XML PATH()
Best Regards Sorna -
Combining multiple rows into a single row
Hi all,
I have a tricky situation in a HR select.
Imagine I have a dataset as below, simplified of course.
Name Start Date End date Job Title Salary
Tom 01/01/07 02/03/08 Gopher £500
Tom 03/03/08 jobsworth £600
Rick 04/05/09 Painter £500
Harry 02/06/07 02/06/08 Gardener £300
Harry 03/06/08 03/06/09 Runner £200
Harry 04/06/09 Cook £400
now, I need to select from above and return 3 rows so it looks as below
name start date enddate title salary start date enddate title salary start date enddate title salary etc etc
tom 01/01/07 02/03/08 gopher £500 03/03/08 blah 600
Rick 04/05/09 painter £500
harry etc etc etc
Now, I know how to select onto one row ok, asumming that each employee has a fixed number of roles but the problem is that each employee has a different number of jobs, one could have had 5 while another 50 and I do not know the maximum at this time.
Anyone have any ideas on how to appraoch this?
tia,
dw
Edited by: derrywriter on Oct 2, 2009 3:50 PM
Edited by: derrywriter on Oct 2, 2009 3:54 PMIdeally this should be done in a suitable reporting tool.
Standard SQL requires a deterministic number of columns to be known at parse time i.e. before the data is fetched it needs to know how many columns are being returned.
If you know there is a fixed maximum to the number of columns that can be returned you can use one of the various pivot methods (search the forum) which differ depending on whether you're using 9i, 10g or 11g database.
If you can't determine a maximum number of columns you're pretty much stuck, unless you want to write some clever interfacing to the oracle ODCI as demonstrated in this thread:
How to pipeline a function with a dynamic number of columns?
Personally, I believe such reporting styles should be reserved for reporting tools. -
Need to generate combination or rows...
Hi,
My query is:
SELECT A.SERVICE_REQUEST_ID serviceRequestId,h.cost_center ,B.COMPANY_ID,
TRUNC(NVL(D.TOTAL_LABOR_HRS *
(SELECT PROPERTY_KEY
FROM SOP_PROPERTY_MASTER
WHERE PROPERTY_TYPE = 'FSRRT'),
0),
2) amount,
E.TAX_CODE taxCode,
FROM SOP_SERVICE_REQUEST A,
DMN_SALES_PARTNER B,
SOP_COMPANY_LOOKUP_VOUCHERING E,
SOP_DMN_WBS_ELMT F,
(SELECT (SUM(LABOR_STOP - LABOR_START) * 24 +
SUM(TRAVEL_STOP - TRAVEL_START) * 24) TOTAL_LABOR_HRS,
srt.SERVICE_REQUEST_ID
FROM SOP_REPORT_TIMESHEET srt, sop_service_report ssr
WHERE ssr.service_request_id = srt.service_request_id AND
ssr.report_id = srt.report_id AND
ssr.report_status <> 'REJECTED'
GROUP BY srt.SERVICE_REQUEST_ID) D ,
SELECT DISTINCT ssrj.service_Request_id , ssu.cost_center
FROM sop_report_timesheet srt, sop_service_report ssr,
sop_service_request_job ssrj, sop_service_user ssu
WHERE ssrj.service_Request_id = ssr.service_request_id AND
srt.service_request_id = ssr.service_request_id AND
ssrj.field_service_rep = ssu.sso_id AND
ssr.service_request_id LIKE '2%' AND
srt.report_id = ssr.report_id AND
ssr.report_status <> 'REJECTED' AND
TRUNC(srt.travel_start) BETWEEN
TO_DATE('&startDate', 'mm/dd/yyyy') AND
TO_DATE('&endDate', 'mm/dd/yyyy')
) h
WHERE WORKFLOW_STATUS IN('ASSIGNED','PARTIAL ASSIGNMENT','PENDING REVIEW','CLOSED')
AND h.SERVICE_REQUEST_ID(+) = A.SERVICE_REQUEST_ID
AND h.service_request_id LIKE '2%'
AND D.SERVICE_REQUEST_ID(+) = A.SERVICE_REQUEST_ID
AND A.WBS_ELEMENT = F.WBS_ELEMENT(+)
AND E.COMPANY_CODE = '&company_code'
AND B.PARTNER_ID(+) = A.COST_SHIP_TO_CUST_ID
AND A.SALES_ORG_ID = B.SALES_ORG_ID
AND B.DOM_EXP_ID = 'DOM'
--AND E.COMPANY_CODE(+) = B.COMPANY_ID
ORDER BY h.cost_center
The output from above query is :
SERVICEREQUESTID COST_CENTER COMPANY_ID AMOUNT taxCode
200136 c1 0701 240 S0
200014 c1 0701 2448 S0
200136 c3 0701 240 S0
200014 c3 0701 2448 S0
200013 c3 0227 17136 S0
I need output as :
SERVICEREQUESTID COST_CENTER COMPANY_ID AMOUNT taxCode
200136 c1 0701 240 S0
200014 c1 0701 2448 S0
c1 0701 4848 --> new row generated which sums Amount
200136 c3 0701 240 S0
200014 c3 0701 2448 S0
200013 c3 0227 17136 S0
c3 0227 19824 S0 --> new row generated which sums AmountI need to break my first result to group it by Cost center and Sum the Amount as shown in 2nd output. A new row will be generated for each cost center summing the amount of all the requests for that cost center. So here for Costcenter C1 the amount is summed for 200136 and 2000014 and displayed in a new row..
for cost center C3, the amount is summed for 2000136, 2000014, 2000013 and is displayed in a new row.
Pls. help
Thx you all in advance,SQL> create table mytable
2 as
3 select 200136 servicerequestid, 'c1' cost_center, '0701' company_id, 240 amount, 'S0' taxcode from dual union al
4 select 200014, 'c1', '0701', 2448, 'S0' from dual union all
5 select 200136, 'c3', '0701', 240, 'S0' from dual union all
6 select 200014, 'c3', '0701', 2448, 'S0' from dual union all
7 select 200013, 'c3', '0227', 17136, 'S0' from dual
8 /
Tabel is aangemaakt.
SQL> select servicerequestid
2 , cost_center
3 , max(company_id) company_id
4 , sum(amount) amount
5 , max(taxcode) taxcode
6 from mytable
7 group by rollup(servicerequestid)
8 , cost_center
9 /
SERVICEREQUESTID CO COMP AMOUNT TA
200014 c1 0701 2448 S0
200136 c1 0701 240 S0
c1 0701 2688 S0
200013 c3 0227 17136 S0
200014 c3 0701 2448 S0
200136 c3 0701 240 S0
c3 0701 19824 S0
7 rijen zijn geselecteerd.Regards,
Rob. -
SQL LOADER - How to combine 3 rows into 1
Hi,
I have an input file composed of 4 different data types in 4 rows.
line1 has fld1 text(100)
line2 has fld2 number(4)
line3 has fld3 date(10) "mm/dd/yyyy"
line4 has fld4 date(10) "mm/dd/yyyy"
all line has data in it.
This is my control file:
LOAD DATA
INFILE "fileA.txt"
truncate
CONCATENATE 4
INTO TABLE ps_vz_ppc_blng_aud
TRAILING NULLCOLS
( text_fld CHAR(100) TERMINATED BY WHITESPACE
,num_fld INTEGER EXTERNAL(4)
TERMINATED BY WHITESPACE
,begin_date DATE(10) "mm/dd/yyyy"
TERMINATED BY WHITESPACE
,end_date DATE(10) "mm/dd/yyyy"
TERMINATED BY WHITESPACE
,row_added_dttm sysdate
,row_added_oprid "USER"
My error: cannot insert null into num_fld.
What did I do wrong? Terminated by whitespace did not end when the line end? Or the first field needs to be 100 characters and ends with end of line?That means the structure of your data is now something like:
line1|1|01/01/2001|02/01/2001
line2|2|01/01/2002|02/01/2002If so, you can use the following control file
LOAD DATA
INFILE "fileA.txt"
truncate
INTO TABLE ps_vz_ppc_blng_aud
FIELDS TERMINATED BY "|" OPTIONALLY ENCLOSED BY '"'
( text_fld char
, num_fld integer external
, begin_date DATE "mm/dd/yyyy"
, end_date DATE "mm/dd/yyyy"
, row_added_dttm sysdate
, row_added_oprid EXPRESSION "USER"
)P.S. There is no automatic notification, just come back from time to time and check for new postings.
Maybe you are looking for
-
Why can't I find a way to make my mail acct. only open with a password?
I want to make it so when I click on my Mail icon on the dock it prompts to type in a password rather than just having the mailbox pop open with all my mail there to read. This has got to be simple??
-
How to define variables in toad sql script editor - newbie
I have just pull out the script of a Function and want to run it on toad SQL editor. I am little bit confused how to define the VARIABLEs here in toad SQL editor to run my script. SELECT NVL(SUM(debit), 0) - NVL(SUM(credit), 0) INTO l_accountBalance
-
I installed Firefox 29 on my Mac and now the computer won't go to sleep.
I have a desktop Mac 10.6.8 with OS X. I recently did a software update with Firefox 29.0 and now my computer will not go to sleep. Do I need to revert back to an earlier version of Firefox?
-
DUAL BOOTING WINDOWS 8.1
I want to dual boot my laptop. I have Windows 8.1 currently installed and want to also have LINUX OS. Please help.
-
In additon to over and over having to close out an endless cascade of windows i'm being inudated with tons of pop-ups. Ultimately after being on for a few hours the problems increase in frequencey and my chromebook gets slower and slower. I've asked