SUM IS INCORRECT
I have a worksheet and the SUM function gives the wrong number. It's really dangerous because I need precision.
I deduced that there is a single cell, that it fails to include in the sum, even if the cell is selected.
I click on the cell, I want to add to the column, then press = and then select the column. The sum is incorrect and fails to add one of the cells
Why?
It is so irritating and so dangerous that I need clarification on this sheet of numbers. Never had this with excel.
Help, please!
Thank you
without details, it is difficult to guess.
Often, the cell is not the same as the other somehow. Maybe it's in text format, or there's a funny character in the cell. Try to copy the data to a new table in a new document to check the results.
If you can validate the data, then we can try too.
Tags: iWork
Similar Questions
-
Bad results ComputeSum native extension of sample
Hi, I have just landed in the world of native extensions of Flash and tried to use the sample.dll extension for example computeSum.
I build the 64 version DLL with Visual Studio 2010. It is running and can be debugged, but the second argument of the function, regardless of its value, is always converted to native 0 long. When the value is traced in the .jsfl script it gives the correct value, but in the native portion is converted to zero and the return value of the sum is incorrect.
I know that this is only an example and this cannot happen in my own native library for other purposes, but I need to know if there is an internal bug in the API native flash for not having headaches more than necessary when debugging my code.
Thanks in advance,
David.
Somehow, it seems that the arguments past number occupies just twice in the argv, so the offset of the first argument is 0, but the offset of the second argument is not 1, but rather 2.
Does anyone have an explanation for this? Y at - it all the compiler settings I should change to get the correct pointer size? Right now I use a macro to access the arguments that just multiplies by 2 to get the 'real' offset
Any ideas would be much appreciated. For the moment, I guess I can continue with this workaround.
David.
-
Can we use aggregate of 2 tables in a single query?
Hi people,
I have a query that goes like this:
Select
Items.1,
Items.2, etc.
Sum (Stock.1),
Sum (Orders.1)
Of
Items, Stock, orders
Where
Items.ID = Stock.ID - (1 to many relationship)
AND
Items.ID = Orders.ID - (1 to many relationship)
Group By
Items.1,
Items.2, etc.
Order by
Items.ID
The idea is that against every item in stock, I should get to total the current level of stocks and inventories of the element 'custom '. In case someone wandering stock are calculated by the movements of stock - in and out - so the "Sum (Stock.1)" is actually a compound essentially statement Sum (stock_In) - Sum (stock_out) (who normally works OK as below)
If I remove the ' table and the columns of the order, I get the right total stock - Sum (Stock.1)
However, the second adding 'Sum' on the table 'Orders' then the two sums give incorrect results (result of Cartesian type)
Similarly, leaving in the 'orders' and removing the 'Stocks' statements give the correct sum of the 'orders '.
So either I'm doing something wrong or does not have two functions aggreagte on different tables in SQL.
If we can not use 2 aggregates of separate tables in a simple SQL query, is there another way to make this request?
Thanks in anticipation!Hello
When you have two (or more) a one-to-many relationship, you need to aggregate each in a separate query.
For example, you can aggregate the orders in a subquery (ordes_summary, below) and combine the stock in the main query, like this:WITH orders_summary AS ( SELECT id , SUM (col_1) AS orders_total FROM orders GROUP BY id ) SELECT i.col_1 , i.col_2 , SUM (s.col_1) AS stock_total , MAX (o.orders_total) AS orders_total FROM items i , stock s , orders_summary o WHERE i.id = s.id AND i.id = o.id GROUP BY i.col_1 , i.col_2 ORDER BY i.col_1 , i.col_2 ;
I hope that answers your question.
If this isn't the case, post some sample data and desired results based on these data, as suggested Anurag. -
Equipped with Windows Vista I put a power on password now says incorrect password
When I got the laptop Toshiba A135 new. Now when I try to start the password is correct, have tried to go to the bios to boot from the CD same thing password incorrect. What can I do? Had installed sp1 Vissta started running slowly. Memory check sum error, then it stopped and now I can't seem to start. Incorrect password. Asked the Geek Squad they said they couldn't fix it.
This forum does not allow anyone to help others to bypass the password protection.
The only suggestion that the right to offer is to reinstall Vista.
Password Protection Strategy...
-
ORA-01789: query block has an incorrect number of columns of results
Hi guys,.
I do the query like this:
Select
SPH. PERIOD,
SPL. PERIODE_DETAIL,
SUM (case when spl.) SUB_KRITERIA = "KEHADIRAN" then spl. NILAI
end) AKTIFITAS_KEHADIRAN
SUM (case when spl.) SUB_KRITERIA = "KONSISTENSI" then spl. NILAI
end) AKTIFITAS_KONSISTENSI
SUM (case when spl.) SUB_KRITERIA = "KERJASAMA" then spl. NILAI
end) KOMUNIKASI_KERJASAMA
SUM (case when spl.) SUB_KRITERIA = "KOORDINASI" then spl. NILAI
end) KOMUNIKASI_KOORDINASI
SUM (case when spl.) SUB_KRITERIA = "INTEGRITAS" then spl. NILAI
end) LOYALITAS_INTEGRITAS
SUM (case when spl.) SUB_KRITERIA = "KEJUJURAN" then spl. NILAI
end) LOYALITAS_KEJUJURAN
SUM (case when spl.) SUB_KRITERIA = "KEPATUHAN" then spl. NILAI
end) LOYALITAS_KEPATUHAN
of sci_pk2m_line@sucodev spl, sci_pk2m_header@sucodev sph
where spl.ID_PK2M_HEADER = sph.ID_PK2M_HEADER
and sph. UNIT_KERJA =: P314_ID_UNIT_KERJA
and sph. = PERIOD: P314_PERIODE
and sph. PERSON_ID =: P314_NPP
Group
SPH. PERIOD,
SPL. PERIODE_DETAIL
UNION ALL
Select
LON
KETERANGAN,
UNIT_KERJA,
PERIOD,
PERSON_ID,
AKTIFITAS_KEHADIRAN,
AKTIFITAS_KONSISTENSI,
KOMUNIKASI_KERJASAMA,
KOMUNIKASI_KOORDINASI,
LOYALITAS_INTEGRITAS,
LOYALITAS_KEJUJURAN,
LOYALITAS_KEPATUHAN
Of
SCI_TOTAL_PK2M_V
where = PERIOD: P314_PERIODE
and PERSON_ID =: P314_NPP;
When I compile and run the program there show the error like this "ORA-01789: block has an incorrect number of columns in query results.
I don't know what does mean,.
could you help me with my problem?
Thank you
Best regards
Jeff
Hi Linda
You made the UNION between a statement select 9 columns to return with a second return 12 columns. Please unify the number of columns selected at a time.
I hope that solves your problem
Concerning
Mahmoud
-
using two sum() in multiple join query
Hello
I'm stuck with the help of two sum() functions in a single query. Are columns of different tables that are joined.
table of charging
Date pay_amt cust_id
1 July 13 500 1
1 July 13 200 1
amount of usage
Date usg_amt cust_id
1 July 13 100 1
2 July 13 300 2
I want a single query to give me sum (pay_amt) and sum (usg_amt) for a client in a single day
That is to say:
o/p should be:
cust_id date sum (pay_amt) sum (usg_amt)
1 01 - Jul 700 100
My query is like below. But it gives incorrect total for both. Could someone tell me why?
Select sum (pay_amt), sum (usg_amt)
from charging r
join in-house use u
On u.cust_id = r.ID_client
and you.date = r.date
where u.cust_id = 1
and you.date = 1 July 13 '
chris227 wrote:
I seem to be a bug to me.
The result is 11.2.0.3
SUM(PAY_AMT) SUM(USG_AMT) 700 200 What is your version?
What looks like the plan to explain it with predicates?
BTW, why do you think that both are incorrect, for me, only the second is incorrect, should be 200 instead of 100.
Post edited by: chris227 Question added
No Chris, the po said they want the o/p 100, and they were getting an invalid value (for example, the 200 is incorrect).
It's because of the joining of the usg_amt of duplication:
SQL > ed
A written file afiedt.buf1 refill as (select date "'2013-07-01 as dt, 500 as pay_amt, 1 as cust_id of union double all the")
2 select dates "2013-07-01', 200, 1 double)
3, use as (select date "'2013-07-01 as dt, 100 in usg_amt, 1 as cust_id of union double all the")
4 Select the dates "2013-07-02', 300, 2 double)
5 --
6 select DT, pay_amt, usg_amt - sum (pay_amt), r.id_client, sum (usg_amt)
7 recharge r
8 join use u on u.cust_id = r.ID_client
9 and you.dt = DT
10 where u.cust_id = 1
11 * and u.dt = date ' 01-07-2013'
SQL > /.CUST_ID DT PAY_AMT USG_AMT
---------- -------------------- ---------- ----------
1 1 JULY 2013 00:00:00 200 100
1 1 JULY 2013 00:00:00 500 100If the sum is of course to sum up 100 twice because of two lines to pay.
So why I have indicated that the aggregation (sum) should usually before the join is made, so it is only made the cust_id amount and date for each table and then joined the results.
-
Hi all
create table tdata ( PERSON_ID number, ORG_ID number, TIMEE number ); insert into tdata (PERSON_ID, ORG_ID, TIMEE) values (363, 1529, 0); insert into tdata (PERSON_ID, ORG_ID, TIMEE) values (363, 1892, 0); insert into tdata (PERSON_ID, ORG_ID, TIMEE) values (597, 309, 20); insert into tdata (PERSON_ID, ORG_ID, TIMEE) values (597, 905, 20); insert into tdata (PERSON_ID, ORG_ID, TIMEE) values (4730, 905, 20); create table thierarch ( ORG_ID number, LV number, PARENT_ORG_ID number ); insert into thierarch (ORG_ID, LV, PARENT_ORG_ID) values (167, 3, 0); insert into thierarch (ORG_ID, LV, PARENT_ORG_ID) values (172, 3, 0); insert into thierarch (ORG_ID, LV, PARENT_ORG_ID) values (905, 1, 1489); insert into thierarch (ORG_ID, LV, PARENT_ORG_ID) values (176, 2, 172); insert into thierarch (ORG_ID, LV, PARENT_ORG_ID) values (309, 1, 176); insert into thierarch (ORG_ID, LV, PARENT_ORG_ID) values (1489, 2, 167); insert into thierarch (ORG_ID, LV, PARENT_ORG_ID) values (1892, 1, 168); insert into thierarch (ORG_ID, LV, PARENT_ORG_ID) values (168, 2, 167); insert into thierarch (ORG_ID, LV, PARENT_ORG_ID) values (1529, 1, 168);
giveswith t as (select org_id, lv, parent_org_id, 'ORG' who_type, 0 timee from thierarch connect by parent_org_id = prior org_id start with parent_org_id = 0 -- union all -- select p.person_id, 0, o.org_id, 'PER', p.TIMEE from (select * from thierarch where lv = 1 connect by parent_org_id = prior org_id start with parent_org_id = 0) o, (select * from tdata) p where o.org_id = p.org_id) -- select rownum, org_id, who_type, parent_org_id, t.lv, TIMEE, (select sum(tt.TIMEE) from t tt start with tt.org_id = t.org_id connect by prior tt.org_id = tt.parent_org_id) as TIMEE from t connect by parent_org_id = prior org_id start with parent_org_id = 0;
but I want toROWNUM ORG_ID WHO_TYPE PARENT_ORG_ID LV TIMEE TIMEE ---------- ---------- -------- ------------- ---------- ---------- ---------- 1 167 ORG 0 3 0 40 2 1489 ORG 167 2 0 40 3 905 ORG 1489 1 0 40 4 4730 PER 905 0 20 20 5 597 PER 905 0 20 40 6 168 ORG 167 2 0 0 7 1892 ORG 168 1 0 0 8 363 PER 1892 0 0 0 9 1529 ORG 168 1 0 0 10 363 PER 1529 0 0 0 11 172 ORG 0 3 0 20 12 176 ORG 172 2 0 20 13 309 ORG 176 1 0 20 14 597 PER 309 0 20 40 14 rows selected SQL>
so for anyone 597 must be 20 because salvation works in two different orgROWNUM ORG_ID WHO_TYPE PARENT_ORG_ID LV TIMEE TIMEE ---------- ---------- -------- ------------- ---------- ---------- ---------- 1 167 ORG 0 3 0 40 2 1489 ORG 167 2 0 40 3 905 ORG 1489 1 0 40 4 4730 PER 905 0 20 20 5 597 PER 905 0 20 20 6 168 ORG 167 2 0 0 7 1892 ORG 168 1 0 0 8 363 PER 1892 0 0 0 9 1529 ORG 168 1 0 0 10 363 PER 1529 0 0 0 11 172 ORG 0 3 0 20 12 176 ORG 172 2 0 20 13 309 ORG 176 1 0 20 14 597 PER 309 0 20 20 14 rows selected SQL>
What did I miss?Hello
The scalar subquery that calculates an incorrect value is looking for a specific org_id in result set t, but org_id is not unique. It looks like the combination of org_id and parent_org_id is unique, so if you want to identify the lines, you must compare the two values.
with t as (select org_id, lv, parent_org_id, 'ORG' who_type, 0 timee from thierarch connect by parent_org_id = prior org_id start with parent_org_id = 0 -- union all -- select p.person_id, 0, o.org_id, 'PER', p.TIMEE from (select * from thierarch where lv = 1 connect by parent_org_id = prior org_id start with parent_org_id = 0) o, (select * from tdata) p where o.org_id = p.org_id) -- select rownum, org_id, who_type, parent_org_id, t.lv, TIMEE, (select sum(tt.TIMEE) from t tt start with tt.org_id = t.org_id AND tt.parent_org_id = t.parent_org_id -- ***** NEW ***** connect by prior tt.org_id = tt.parent_org_id) as TIMEE from t connect by parent_org_id = prior org_id start with parent_org_id = 0;
I added only 1, line 5 from the end.
Depending on your data and your needs, you may need to do the same kind of change elsewhere in the query, where org_id is used.This whole request seems unnecessarily complicated. I don't know what you're trying to do, but it is difficult to imagine anyting you are trying maybe that we can't do with 1 or 2 possible, CONNECT BY query, and not 4 as you use.
-
Photoshop-trial - incorrect checksum
iMac Core 2 Duo 2.4 GHz
OS X 10.6.8
4 GB of ram
> 900 GB of free
I downloaded the trial 4 times now, different times of the day. Get the incorrect checksum after download. Disk utility can not verify with the CRC32 even exact on the last three files (I deleted the first). Same error every time:
The CRC, looks like I have exactly the same file each time.
I regularly download > 1 GB files every day, > 8 GB files per week (on another computer) and the checksums match. Should prove my connection ISP/Internet is not to blame, because it was suggested solution (use a different ISP). I could use this computer to download but it's Windows and I want the Mac version.
IS THERE A DIRECT LINK TO DOWNLOAD THE TRIAL?
I Reset Safari, I deleted the cache and ADA prefrences, I started cold, I save the file in different locations in my user folder, still get the same CRC every time.
Jeff - Thanks for trying to help. I have all the step 1 no change in symptoms. I kept getting SAME CRC CHECKSUM (in disk utility) with each download:
$68976E38, 811480 B $9 expected
The solution that I couldn't find in the forums was to type this command in a Terminal:
> com.apple.frameworks.diskimages: write skip - verify - bool YES
This allowed me to mount the disk image and install Photoshop without a hitch.
Thanks to Sumi in Live Chat for this command!
-
OVERALL TOTAL incorrect (with COUNT DISTINCT)
Hello
I get incorrect results in a DISTINCT COUNT measure column GRAND TOTAL.
I have 5 separate in Paris and 10 separate clients in New York, I want the grand total for the sum of the two, it is 15.
But OBIEE calculates separate customers for all cities, so if there are customers in Paris and New York, the result is false.
This is the result I get:
City Number_Distinct_Customers
----------------------------------------------------------------------------
Paris 5
NEW YORK CITY 10
GRAND TOTAL 12
12 is the number of all separate clients.
The correct GRANT TOTAL is expected to be 5 + 10 = 15
Thank you
ConcerningI guess that COUNT(DISTINCT...) is regarded as the default aggregation in the Oracle replies.
To come in this, change the State of aggregation of fx (formula column in the criteria of answers tab) to 'SUM '...Let me know if that solves your problem.
-bifacts :-)
http://www.obinotes.com -
Incorrect results to view online help?
Hi I have the following query (on 10.2.0.4):
The line view alias role_tab returns exactly the same results using UNION or UNION ALL, ie. I remove all other tables and execute select role_tab on the tables of the WITH clause.WITH hel_grantees AS (SELECT /*+ MATERIALIZE */ * FROM (SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code ,DENSE_RANK() OVER(PARTITION BY rol_pol_no ORDER BY rol_pol_no ,DECODE(rol_rot_code ,'TRUSTEE', 1 ,'CELLHOLDER', 2 ,'ASSIGNEE', 3 ,'GRANTEE', 4 ,'ASSURED', 5 )) priority FROM pa_roles_mv WHERE rol_end_date IS NULL AND rol_pol_no IS NOT NULL AND rol_cpy = 'HEL' AND rol_rot_code IN ('ASSIGNEE', 'TRUSTEE', 'GRANTEE', 'ASSURED' ,'CELLHOLDER')) WHERE priority = 1 AND rol_rot_code = 'GRANTEE') ,hel_assignees AS (SELECT /*+ MATERIALIZE */ * FROM (SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code ,DENSE_RANK() OVER(PARTITION BY rol_pol_no ORDER BY rol_pol_no ,DECODE(rol_rot_code ,'TRUSTEE', 1 ,'CELLHOLDER', 2 ,'ASSIGNEE', 3 ,'GRANTEE', 4 ,'ASSURED', 5 )) priority FROM pa_roles_mv WHERE rol_end_date IS NULL AND rol_cpy = 'HEL' AND rol_pol_no IS NOT NULL AND rol_rot_code IN ('ASSIGNEE', 'TRUSTEE', 'GRANTEE', 'ASSURED' ,'CELLHOLDER')) WHERE priority = 1 AND rol_rot_code = 'ASSIGNEE') ,hel_cellholders AS (SELECT /*+ MATERIALIZE */ * FROM (SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code ,DENSE_RANK() OVER(PARTITION BY rol_pol_no ORDER BY rol_pol_no ,DECODE(rol_rot_code ,'TRUSTEE', 1 ,'CELLHOLDER', 2 ,'ASSIGNEE', 3 ,'GRANTEE', 4 ,'ASSURED', 5 )) priority FROM pa_roles_mv WHERE rol_end_date IS NULL AND rol_cpy = 'HEL' AND rol_pol_no IS NOT NULL AND rol_rot_code IN ('ASSIGNEE', 'TRUSTEE', 'GRANTEE', 'ASSURED' ,'CELLHOLDER')) WHERE priority = 1 AND rol_rot_code = 'CELLHOLDER') ,hel_assureds AS (SELECT /*+ MATERIALIZE */ y.rol_cpy, y.rol_pol_no rol_pol_no, y.rol_number ,y.rol_rot_code FROM (SELECT * FROM (SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code ,DENSE_RANK() OVER(PARTITION BY rol_pol_no ORDER BY rol_pol_no ,DECODE(rol_rot_code ,'TRUSTEE', 1 ,'CELLHOLDER', 2 ,'ASSIGNEE', 3 ,'GRANTEE', 4 ,'ASSURED', 5 )) priority FROM pa_roles_mv WHERE rol_end_date IS NULL AND rol_cpy = 'HEL' AND rol_pol_no IS NOT NULL AND rol_rot_code IN ('ASSIGNEE', 'TRUSTEE', 'GRANTEE', 'ASSURED' ,'CELLHOLDER')) WHERE priority = 1 AND rol_rot_code = 'TRUSTEE') x ,pa_roles_mv y WHERE x.rol_pol_no = y.rol_pol_no AND y.rol_end_date IS NULL AND y.rol_cpy = 'HEL' AND y.rol_rot_code = 'ASSURED') ,hil_grantees AS (SELECT /*+ MATERIALIZE */ * FROM (SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code ,DENSE_RANK() OVER(PARTITION BY rol_pol_no ORDER BY rol_pol_no ,DECODE(rol_rot_code ,'TRUSTEE', 1 ,'CELLHOLDER', 2 ,'ASSIGNEE', 3 ,'GRANTEE', 4 ,'ASSURED', 5 )) priority FROM pa_roles_mv WHERE rol_end_date IS NULL AND rol_pol_no IS NOT NULL AND rol_rot_code IN ('ASSIGNEE', 'TRUSTEE', 'GRANTEE', 'ASSURED' ,'CELLHOLDER')) WHERE priority = 1 AND rol_rot_code = 'GRANTEE') ,hil_assignees AS (SELECT /*+ MATERIALIZE */ * FROM (SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code ,DENSE_RANK() OVER(PARTITION BY rol_pol_no ORDER BY rol_pol_no ,DECODE(rol_rot_code ,'TRUSTEE', 1 ,'CELLHOLDER', 2 ,'ASSIGNEE', 3 ,'GRANTEE', 4 ,'ASSURED', 5 )) priority FROM pa_roles_mv WHERE rol_end_date IS NULL AND rol_cpy = 'HIL' AND rol_pol_no IS NOT NULL AND rol_rot_code IN ('ASSIGNEE', 'TRUSTEE', 'GRANTEE', 'ASSURED' ,'CELLHOLDER')) WHERE priority = 1 AND rol_rot_code = 'ASSIGNEE') ,hil_cellholders AS (SELECT /*+ MATERIALIZE */ * FROM (SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code ,DENSE_RANK() OVER(PARTITION BY rol_pol_no ORDER BY rol_pol_no ,DECODE(rol_rot_code ,'TRUSTEE', 1 ,'CELLHOLDER', 2 ,'ASSIGNEE', 3 ,'GRANTEE', 4 ,'ASSURED', 5 )) priority FROM pa_roles_mv WHERE rol_end_date IS NULL AND rol_cpy = 'HIL' AND rol_pol_no IS NOT NULL AND rol_rot_code IN ('ASSIGNEE', 'TRUSTEE', 'GRANTEE', 'ASSURED' ,'CELLHOLDER')) WHERE priority = 1 AND rol_rot_code = 'CELLHOLDER') ,hil_assureds AS (SELECT /*+ MATERIALIZE */ 'HIL' rol_cpy, y.rol_pol_no rol_pol_no, y.rol_number ,y.rol_rot_code FROM (SELECT * FROM (SELECT rol_pol_no, rol_number, rol_rot_code ,DENSE_RANK() OVER(PARTITION BY rol_pol_no ORDER BY rol_pol_no ,DECODE(rol_rot_code ,'TRUSTEE', 1 ,'CELLHOLDER', 2 ,'ASSIGNEE', 3 ,'GRANTEE', 4 ,'ASSURED', 5 )) priority FROM pa_roles_mv WHERE rol_end_date IS NULL AND rol_cpy = 'HIL' AND rol_pol_no IS NOT NULL AND rol_rot_code IN ('ASSIGNEE', 'TRUSTEE', 'GRANTEE', 'ASSURED' ,'CELLHOLDER')) WHERE priority = 1 AND rol_rot_code = 'TRUSTEE') x ,pa_roles_mv y WHERE x.rol_pol_no = y.rol_pol_no AND y.rol_end_date IS NULL AND rol_cpy = 'HIL' AND y.rol_rot_code = 'ASSURED') SELECT rol_cpy, rol_number, rol_type, cpy_name, cpy_cty_code FROM dmf_transactions JOIN dmd_transaction_types ON dtrt_id = ftrn_dtrt_id AND dtrt_code = 'RPT' JOIN dmd_policies ON dpol_id = ftrn_dpol_id AND dpol_pp_ind != 'Y' JOIN dmd_times ON dtim_id = ftrn_dtim_id JOIN (SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code FROM hil_grantees UNION SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code FROM hil_assureds UNION SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code FROM hil_cellholders UNION SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code FROM hil_assignees UNION SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code FROM hel_grantees UNION SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code FROM hel_assureds UNION SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code FROM hel_cellholders UNION SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code FROM hel_assignees) role_tab ON rol_pol_no = dpol_pol_no AND rol_cpy = dpol_cpy_flag JOIN (SELECT cpy_cpy, cpy_number, 'CPY' rol_type, cpy_name ,cpy_cty_code FROM pa_companies_mv UNION ALL SELECT psn_cpy, psn_number, 'PSN', psn_surname, psn_cty_code FROM pa_persons_mv) ON rol_cpy = cpy_cpy AND rol_number = cpy_number WHERE ftrn_end_dtim_id IS NULL AND ftrn_status IN('P', 'D') AND dpol_id IN( SELECT fpol_dpol_id FROM dmf_policies JOIN dmd_policy_statuses ON dps_id = fpol_dps_id AND dps_status_group = 'IN FORCE' WHERE fpol_dtim_timestamp = (SELECT dwutils.getdwsysdateid FROM DUAL) AND fpol_premium_freq = 'S') GROUP BY rol_cpy, rol_number, rol_type, cpy_name, cpy_cty_code HAVING SUM(ftrn_mamount_gbp) > 225000;
What is expected as the return values are logically unique.
So I decided to go with UNION ALL to the performance. However, the returned results are different when used in the context of the entire query - with UNION 122 096 rows are returned, UNION ALL returns 137 904...
This could be the cause, I may be missing something, but it seems to me that one or both sets of results must by incorrect?
Any ideas or help would be greatly appreciated.
See you soon
BenI think that your problem lies here:
,hil_grantees AS (SELECT /*+ MATERIALIZE */ * FROM (SELECT rol_cpy, rol_pol_no, rol_number, rol_rot_code ,DENSE_RANK() OVER(PARTITION BY rol_pol_no ORDER BY rol_pol_no ,DECODE(rol_rot_code ,'TRUSTEE', 1 ,'CELLHOLDER', 2 ,'ASSIGNEE', 3 ,'GRANTEE', 4 ,'ASSURED', 5 )) priority FROM pa_roles_mv WHERE rol_end_date IS NULL ---> AND rol_pol_no IS NOT NULL AND rol_rot_code IN ('ASSIGNEE', 'TRUSTEE', 'GRANTEE', 'ASSURED' ,'CELLHOLDER')) WHERE priority = 1 AND rol_rot_code = 'GRANTEE')
you are missing the following line:
AND rol_cpy = 'HIL'
So presumably you will get HEL so much HIL rows in the subquery, but you also get the lines of HEL in an another subquery. UNION will remove the duplicate set.
I think you could do this in a more easy way, by collapsing your subqueries in one (or maybe two) - looks that you single out a TRANSFEREE line if you have a line of TRUSTEE, which you could do this by adding a pivot.
-
trigger for update field in a table with the sum of the fields to another table
My experience in creation of triggers and pl/sql in general can be described in terms of oracle with the null value. I practiced by creating arrays and applications on my personal server at home to help me with some of my work related tasks. Right now I am creating a trigger which will, after insert, update, delete on the update of the table assignment_time_track the area of the time_spent on the table of assignments with the sum of the time_spent on the assignment_time_track table fields. I hope that run on the sentence it is clear to the people other than me. I tried this script on my own using the tool of creation of trigger for Oracle Database Express Edition, but I get the following error:
Create a trigger failed, for the following reason:
ORA-06552: PL/SQL: ORA-06553 finished Compilation unit analysis: PLS-320: the declaration of the type of the expression is incomplete or incorrect
Here is my attempt to create the trigger on my own.
create or replace trigger "ASSIGNMENT_TIME_TRACK_T1".
AFTER
INSERT or update or delete on 'ASSIGNMENT_TIME_TRACK '.
for each line
Start
update assignments
Set time_spent = (select sum (time_spent)
of assignment_time_track
where assignment_time_track.name = assignments.name);
end;
/
If what I posted is not clear or more detail is needed, let me know and I will respond with a full description of tables and my goals for each table. Thanks in advance for any help. I also gladly accepts links to tutorials or lessons that explain how to do this kind of thing.
Published by: bobonthenet on March 9, 2009 14:01I think I understand what you mean :)
Rather than use a trigger to keep the master table (assignments) in sync with the time spent on the details, it would be much easier to use a query to do this, maybe creating a view.
Something along the lines of
SQL> create table assignments 2 (id number primary key 3 ,name varchar2(10) 4 ); Table created. SQL> SQL> create table assignment_time_tbl 2 (id number primary key 3 ,assid number references assignments 4 ,time_spent number 5 ); Table created. SQL> SQL> insert into assignments 2 select rownum 3 , 'a' 4 from all_objects 5 where rownum < 5 6 / 4 rows created. SQL> SQL> insert into assignment_time_tbl 2 select rownum 3 , rownum 4 , rownum * 3 5 from all_objects 6 where rownum < 5 7 / 4 rows created. SQL> SQL> commit; Commit complete. SQL> SQL> SQL> select a.id 2 , a.name 3 , (select sum (time_spent) 4 from assignment_time_tbl 5 where assid = a.id 6 ) 7 from assignments a 8 / ID NAME (SELECTSUM(TIME_SPENT)FROMASSIGNMENT_TIME_TBLWHEREASSID=A.ID) ---------- ---------- ------------------------------------------------------------- 1 a 3 2 a 6 3 a 9 4 a 12
-
Hello
I need help with something with that I'm struggling
When I wrote <? xdoxslt:IfElse ((CF_OP_BAL > 0), (CF_OP_BAL + xdoxslt:sum(DEBIT)),xdoxslt:sum(DEBIT))?) > it works fine...
but now I need to manage xdoxslt:sum (DEBIT) null...
so, I tried...
<? xdoxslt:IfElse ((CF_OP_BAL > 0), (CF_OP_BAL + decode(xdoxslt:sum(DEBIT),",0,xdoxslt:sum(DEBIT)),decode(xdoxslt:sum(DEBIT),",0,xdoxslt:sum(DEBIT)))? >))
This gives XPATH Incorrect error...
Concerning
RigotHello
Try:
0),(CF_OP_BAL+sum(DEBIT[.!=''])),(sum(DEBIT[.!=''])))?>{code}Regards, Colectionaru Edited by: Colectionaru on Dec 15, 2008 7:36 AM
-
6 iOS10 incorrect percentage battery iPhone
On my 6 running latest iOS iPhone 10 (10.0.1) my battery indicator in percentage is incorrect most of the time. I can't tell if the percentage indicator is stuck or something. This happened 9 w/IOS, but seems aggravated with iOS 10. Here are two typical scenarios:
1. indicator indicates the value > 50%, but then stops
2. indicator indicates the value ~ 10%, but then when it is plugged in charge indicator of cable past at 30%.
I see that when people are complaining about this preliminary response was to "upgrade to iOS 9.3 +'-well, which obviously does not work for me." I would like to have an indicator that represents the amount of battery life I have left.
Bart Taylor wrote:
On my 6 running latest iOS iPhone 10 (10.0.1) my battery indicator in percentage is incorrect most of the time. I can't tell if the percentage indicator is stuck or something. This happened 9 w/IOS, but seems aggravated with iOS 10. Here are two typical scenarios:
1. indicator indicates the value > 50%, but then stops
2. indicator indicates the value ~ 10%, but then when it is plugged in charge indicator of cable past at 30%.
I see that when people are complaining about this preliminary response was to "upgrade to iOS 9.3 +'-well, which obviously does not work for me." I would like to have an indicator that represents the amount of battery life I have left.
-
Apple maps address and continuous route of incorrect information after four years
The address of the map and driving directions in IOS devices 3/4 Ave., Almena, WI 54805 continues to be incorrect in Apple Maps to 369 12. We have presented more than 15 applications over the past 4 years to this fixed and submitted two photos geocoded with delivery address and Barron County, WI property and survey records of SIG showing the right address but this remains unclear. On an IOS device, if you enter the address 369 12 3/4 Ave., Almena, WI 54805 map will take you to the correct location on the map, but the map shows an address of 369 12 3/4 Ave., Turtle Lake, WI 54889. And if you have driving directions to 369 12 3/4 Ave., Almena, WI 54805 that will correctly identify the map take you somewhere 369 S 4th Ave, Alpena, MI 49707, 500 miles.
Apple is not regularly monitor the discussions. These are mostly a user in discussions.
Send feedback to Apple. They will not respond, but at least know that there is a problem or a suggestion for change. If enough people send feedback, it can get change / suggested the problem solved as soon as possible.
-
My iphone 5 c (IOS 9.3) sent my incorrect position.
My iphone 5 c (IOS 9.3) sent my incorrect position. I have 'share my location' with my husband and this day there, he checked my position and it showed that I was about 1 to 1 1/2 miles away at a park (I've never been to). I was home at the time and wifi may have been down, but I can't understand why it was closed so far.
If there is no wifi, cellular service (I have Verizon) would not in the correct location? I even checked the location history on my phone and it me House shows during this period and shows the whole story to that area of the Park? Which would be so far off the coast?
Thank you.
If the phone can't get a current location due to the Internet being down, or in the case that the reception is not good enough to triangulate your location using nearby cell towers, the nearest known position will be displayed. If there is a cell tower near this park, it could also be stated as your position until your appliance again to a new location or the quality of the signal is still improving.
Maybe you are looking for
-
Put in error place a Time Capsule
Hello, I recently bought a recon Time Capsule and when I go to the airport, it happens to "consider the base station" and then I get "error has occurred." Can anyone help? I am running Yosemite 10.10.5 MacBook pro (15 retina in mid-2014) 2.2 Intel co
-
Read the story of calibration veriStand Vi file
I need to update the scale and offset for channels to HAVE it. I'm looking for an easy way to read the stored scale and offset values from the file history of Calibration and apply them to the user channels that will be used in calculated channels. I
-
My laptop continues to repeat the point on XP sp3 do not load plse XPx86KB2446704 help.
-
HP Compaq Pro 4300 All in One – Wireless NIC will not install
Hey everybody. I got a doozy and I can't understand it. I have a HP Compaq Pro 4300 AIO I have Win 7 Enterprise 32-bit All the drivers seem to be installed correctly, however when it comes to woreless NIC, it won't load. I tried all the drivers avail
-
Issue using the external monitor.
I was given an external monitor that I could connect to my laptop. I forgot the keys I had hit to use the external monitor. I got disabling it on the screen that turned my monitor on the laptop. I can't find a way to re - turn on the monitor. I c