for the sum (tot)
HelloI have this request, that there is a long query in group by, I need just sum (tot) Erstfeld
SELECT distinct h.slurry_type,
( ( NVL (f.calc_cement_sk, f.calc_amount)
* NVL (f.item_price, 0)
)
- ( NVL (f.calc_cement_sk, f.calc_amount)
* NVL (f.item_price, 0)
* (NVL (f.dis_per, 0) / 100)
)
) tot
FROM napesco_log_generic_sum gen,
xxnp_opn_joblog_stage_002 g,
xxnp_opn_joblog_slurry_003 h,
xxnp_opn_joblog_est_002 f
where gen.opn_job_desc='K/D/KD43/UG187/958/D/0211/1'
AND GEN.TRAN_TYPE='Material'
AND gen.opn_joblog_001_id = g.opn_joblog_001_id
AND g.opn_joblog_006_id = h.opn_joblog_006_id
AND h.opn_joblog_007_id = f.opn_joblog_007_id
output is as follows
SLURRY_TYPE TOT
Lead 64.35
Lead 104.05
Lead 990.90
Lead 1,070.45
Lead 1,422.72
Lead 1,527.50
Lead 4,098.90
Tail 64.65
Tail 159.90
Tail 391.30
Tail 662.76
Tail 1,059.15
Tail 2,546.70
Top Up 0.00
i want
slurry_type tot
lead sum(tot) for lead
tail sum(tot) for tail
top up sum(tot) for top up
kindly guide methanking in advance
Published by: makdutakdu on March 21, 2011 14:59
Just add a function of Group:
SELECT h.slurry_type,
SUM(( (NVL(f.calc_cement_sk, f.calc_amount) * NVL(f.item_price, 0))
- ( NVL(f.calc_cement_sk, f.calc_amount)
* NVL(f.item_price, 0)
* (NVL(f.dis_per, 0) / 100)
)
)) tot
FROM napesco_log_generic_sum gen,
xxnp_opn_joblog_stage_002 g,
xxnp_opn_joblog_slurry_003 h,
xxnp_opn_joblog_est_002 f
WHERE gen.opn_job_desc = 'K/D/KD43/UG187/958/D/0211/1'
AND gen.tran_type = 'Material'
AND gen.opn_joblog_001_id = g.opn_joblog_001_id
AND g.opn_joblog_006_id = h.opn_joblog_006_id
AND h.opn_joblog_007_id = f.opn_joblog_007_id
GROUP BY h.slurry_type
Tags: Database
Similar Questions
-
Hello
I'm having a problem trying to the sum of 200 items I've read in a loop for, for then to get the average value. the value that I'm reading is a temeperature, but is oscilates and I need to get an average value for the pid controller don't get 'confused' by the waves.
can someone help me please?
Try something like that. I can't test it here, because I don't have the equipment.
-
JavaScript for the sum of a column cells
Hi all -
I have a table in expansion (lines can be added) and I am using the line of the column footer to calculate the average of the cells which do not have the value 0.
Form Calc is usually great, but in this case, I need to divide the sum by the number of cells that are not zero and I don't know how to do this via form Calc.
Successfully used javascript to identify the total number of occurrences and identify the number of instances that are zero, then the part of the denominator of the equation is fine. (Number of cases - number of zeros = denominator.)
Now, it's just the numerator. There must be a loop, right?
Is called table: table1
Line is called: data
cell is called: rated
Any thoughts? Or more effective methods? Thank you very much.
B
Hello
a solution in FormCalc could look this way:
form1.#subform[0].table1.footer.sum::calculate - (FormCalc, client) var c = 0 var s = 0 for i = 0 upto (_data.count - 1) do if (data[i].eValue gt 0) then c = Sum(c, 1) s = Sum(s, data[i].eValue) endif endfor if (s gt 0 and c gt 0) then $ = Round(s / c) else $ = 0 endif
Put this scriot in the calculate of the cell of the footer line event.
-
A simple query to write for the SUM of a column
Hello
I have a Quantity column. I want his total.
For a PURCHASE, I would like to add the value in the column Qunatity.
For a COPY, I want to subtract the value in the column Qunatity.
So overall, the sum of the column should give me total buy less total sells.
Any help is welcome.
Thank you.
Published by: TechVortex on August 11, 2011 11:49Like this?
SQL> ed Wrote file afiedt.buf 1 with sample_data as 2 ( 3 select 100 quantity, 'B' flag from dual union all 4 select 200, 'B' from dual union all 5 select 100, 'S' from dual union all 6 select 500, 'B' from dual union all 7 select 200, 'S' from dual 8 ) 9 SELECT SUM(quantity), 10 SUM(DECODE(flag, 'B', quantity, 11 'S', -quantity)) absolute_sum 12* FROM sample_data SQL> / SUM(QUANTITY) ABSOLUTE_SUM ------------- ------------ 1100 500
-
Hello
SELECT SUM (coalesce (cast (b.co1000000351 AS INT), 0)) + sum (coalesce (CAST (b.co1000000352 as INT), 0)) + sum (coalesce (CAST (b.co1000000353 as INT), 0)) as a result
of B2601 b, T2601 t
where b.C1 = t.C1 AND t.C1000000161 = 'PR00003525614'
B.c1 group
In the above query, I get the result successfully:Result
------
100
300
400I want to do is the sum of the sum of the values from the query and result either 800 above = 100 + 300 + 400
I tried, but my request is in error:
SELECT SUM)
SELECT SUM (coalesce (cast (b.co1000000351 AS INT), 0)) + sum (coalesce (CAST (b.co1000000352 as INT), 0)) + sum (coalesce (CAST (b.co1000000353 as INT), 0)) as a result
of B2601 b, T2601 t
where b.C1 = t.C1 AND t.C1000000161 = 'PR00003525614'
B.c1 group
)
Double; -In error
Any help please.Remove the GROUP BY and try
Select sum (coalesce (cast (b.co1000000351 as int), 0)) +.
sum (coalesce (cast (b.co1000000352 as int), 0)) +.
sum (coalesce (cast (b.co1000000353 as int), 0)) as a result
of b2601 b
t2601 t
where b.c1 = t.c1
and t.c1000000161 = 'PR00003525614. '
-
SQL for the sum of a column while avoiding the repetition of values
Dear all
I have this table called Loans_installments that contains the client's loan payments.
sample data:
the client_id loan_no inst_mat_date inst_seq original_inst_amt int_amt currency management
110 2 222 100 1/1/2013 1 0 50
110 2 222 100 1/2/2013 2 0 52
110 2 222 100 1/3/2013 3 0 54
110 2 222 100 1/4/2013 4 500 90
110 2 222 100 1/5/2013 5 0 50
110 2 222 100 1/6/2013 6 0 51
110 2 222 100 7/1/2013 7 0 50
110 2 222 100 1/8/2013 8 600 105
110 2 222 100 1/9/2013 9 0 50
110 2 222 10 100 1/10 / 2013 0 54
110 2 222 100 1/11 / 2013 11 0 50
110 2 222 100 1/12 / 2013 12 700 120
now what I want to do the sum of int_amt field based on original_inst_amt value (0 or a value) and put the result on the int_amt who has an orig_inst_amt value <>0.
the result should be like this:
the client_id loan_no inst_mat_date inst_seq original_inst_amt int_amt currency management
110 2 222 100 1/1/2013 1 0 0
110 2 222 100 1/2/2013 2 0 0
110 2 222 100 1/3/2013 3 0 0
110 2 222 100 1/4/2013 4 500 246
110 2 222 100 1/5/2013 5 0 0
110 2 222 100 1/6/2013 6 0 0
110 2 222 100 7/1/2013 7 0 0
110 2 222 100 1/8/2013 8 600 256
110 2 222 100 1/9/2013 9 0 0
110 2 222 100 1/10 / 2013 10 0 0
110 2 222 100 1/11 / 2013-11 0 0
110 2 222 100 1/12 / 2013 12 700 274
any help please.With the help of the clause type
SQL> with t 2 as 3 ( 4 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/1/2013','mm/dd/yyyy') inst_mat_date, 1 inst_seq, 0 original_inst_amt, 50 int_amt from dual 5 union all 6 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/2/2013','mm/dd/yyyy') inst_mat_date, 2 inst_seq, 0 original_inst_amt, 52 int_amt from dual 7 union all 8 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/3/2013','mm/dd/yyyy') inst_mat_date, 3 inst_seq, 0 original_inst_amt, 54 int_amt from dual 9 union all 10 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/4/2013','mm/dd/yyyy') inst_mat_date, 4 inst_seq, 500 original_inst_amt, 90 int_amt from dual 11 union all 12 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/5/2013','mm/dd/yyyy') inst_mat_date, 5 inst_seq, 0 original_inst_amt, 50 int_amt from dual 13 union all 14 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/6/2013','mm/dd/yyyy') inst_mat_date, 6 inst_seq, 0 original_inst_amt, 51 int_amt from dual 15 union all 16 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/7/2013','mm/dd/yyyy') inst_mat_date, 7 inst_seq, 0 original_inst_amt, 50 int_amt from dual 17 union all 18 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/8/2013','mm/dd/yyyy') inst_mat_date, 8 inst_seq, 600 original_inst_amt, 105 int_amt from dual 19 union all 20 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/9/2013','mm/dd/yyyy') inst_mat_date, 9 inst_seq, 0 original_inst_amt, 50 int_amt from dual 21 union all 22 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/10/201','mm/dd/yyyy') inst_mat_date, 10 inst_seq, 0 original_inst_amt, 54 int_amt from dual 23 union all 24 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/11/201','mm/dd/yyyy') inst_mat_date, 11 inst_seq, 0 original_inst_amt, 50 int_amt from dual 25 union all 26 select 110 branch, 2 currency, 222 client_id, 100 loan_no, to_date('1/12/201','mm/dd/yyyy') inst_mat_date, 12 inst_seq, 700 original_inst_amt, 120 int_amt from dual 27 ) 28 select branch 29 , currency 30 , client_id 31 , loan_no 32 , inst_mat_date 33 , inst_seq 34 , original_inst_amt 35 , decode(original_inst_amt, 0, 0, sum(int_amt) over(partition by cnt)) int_amt 36 from ( 37 select branch 38 , currency 39 , client_id 40 , loan_no 41 , inst_mat_date 42 , inst_seq 43 , original_inst_amt 44 , int_amt 45 , cnt 46 from t 47 model 48 dimension by 49 ( 50 inst_seq 51 ) 52 measures 53 ( 54 branch, currency, client_id, loan_no, inst_mat_date, original_inst_amt, int_amt, 1 cnt 55 ) 56 rules 57 ( 58 cnt[any] = case 59 when original_inst_amt[cv()-1] > 0 then 60 cnt[cv()-1] + 1 61 else 62 nvl(cnt[cv()-1], cnt[cv()]) 63 end 64 ) 65 ) 66 / BRANCH CURRENCY CLIENT_ID LOAN_NO INST_MAT_ INST_SEQ ORIGINAL_INST_AMT INT_AMT ---------- ---------- ---------- ---------- --------- ---------- ----------------- ---------- 110 2 222 100 01-JAN-13 1 0 0 110 2 222 100 02-JAN-13 2 0 0 110 2 222 100 03-JAN-13 3 0 0 110 2 222 100 04-JAN-13 4 500 246 110 2 222 100 05-JAN-13 5 0 0 110 2 222 100 06-JAN-13 6 0 0 110 2 222 100 08-JAN-13 8 600 256 110 2 222 100 07-JAN-13 7 0 0 110 2 222 100 09-JAN-13 9 0 0 110 2 222 100 11-JAN-01 11 0 0 110 2 222 100 10-JAN-01 10 0 0 110 2 222 100 12-JAN-01 12 700 274 12 rows selected. SQL>
-
How to store and search for the sum of primes in a loop from 1 to an arbitrary value of N
I am interested in a labview 8.5 program to find successive prime numbers from 1 to N arbitrary number given as input and find out their sum as put on front.
Well well, OK, then. Some honesty. It's actually very refreshing. So what have you tried so far? We can offer tips and advice, but you won't have to do your homework for you. You have an algorithm? Do you know how to determine if a number is a prime number? Start with something simple. Find a way store a running total in a loop. Not too hard. Tip: Shift register (or a more recent version of LabVIEW, Feedback node)
-
Captivate 4 module for the sum total of publish
Hello everyone. I have two training modules that are not rated. They are not simulations, demonstrations. I need to publish them so that they can be added to a total LMS customers. Should what settings I use when the publication of LMS? And any tips or tricks I should know? I don't have access to the LMS. For our training, we organize our own Web pages.
Thank you
Hello
In the interactive object's properties dialog box (button box or click) go to the reports tab, select include in the questionnaire. Default partition is 1 point which is OK.
Lilybiri
-
The sum of all invoices and view total
Hello
I do perhaps the hardest way but the case is the following:
I want to calculate all the Bills of the largeOrders2 collection and collect all the item.totalPrice 'values' in a table and assign a total that I can use on the site, up to now, I have my code as follows:
{module_data resource = "customers" resourceId = "{{globals.user.entityId}}" subresource = "orders" version = "v3" collection = "largeOrders2" "}
{% for article on largeOrders2.items-%}
{% assign invoicetotals = item.totalPrice | round-%} * summarize all invoices as a single total and pass it to a liquid tag
< span class = "red sumInvoice" > {{invoicetotals}} </span >
{% endfor}
< div class = "result" > Total spent on shopping: {capture totalInvoices %} < span class = "totalsum" > < / span > £{% endcapture} {{totalInvoices}} < / div >}
< script type = "text/javascript" >
var sum = 0;
$('.sumInvoice').each (function () {}
sum += parseFloat ($(this) .text ()); Or this.innerHTML, this.innerText
$(".totalsum").text (sum);
});
< /script >
use {{totalInvoices}} in a {% if order_requirement < totalinvoices-%} declaration.
I'm quite sure, there is an easier way, but I have not found a solution for the sum of an array using liquid and obtaining data from the result instead of text().
Thank you
You don't need any JavaScript for this and you just need to sort your liquid.
Things of importance to note:
-You have a collection and it will be not more then 500 items
-You create an entitled 'Total' ready before your loop with a value of 0 is a number
-You do the following your loop for: {% assign invTotal = invTotal: so: item.totalPrice-%}
- As you loop your value will be added to each invoice
-{{invTotal}} will give you your total value.
-
Calculate the sum of the duration stored in format HH24
Dear professionals,
I use Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production. I stored length of certain events in the table TIME_DURATION as as follows (format h24:mi):
CREATE TABLE "TIME_DURATION" ("ID" NUMBER(11,0), "HOURSMINUTES" VARCHAR2(5)); Insert into TIME_DURATION (ID,HOURSMINUTES) values ('5','00:55'); Insert into TIME_DURATION (ID,HOURSMINUTES) values ('7','00:18'); Insert into TIME_DURATION (ID,HOURSMINUTES) values ('9','06:34'); Insert into TIME_DURATION (ID,HOURSMINUTES) values ('15','00:12'); Insert into TIME_DURATION (ID,HOURSMINUTES) values ('17','09:50'); INSERT INTO TIME_DURATION (ID,HOURSMINUTES) VALUES ('41','12:39');
select * from time_duration; ID HOURS ---------- ----- 5 00:55 7 00:18 9 06:34 15 00:12 17 09:50 41 12:39 6 rows selected.
Now, I want to calculate the total time for all events (sum of all specific times). In this case, it should be 30 hours and 38 minutes.
Any help would be much appreciated.
Thanks in advance.
Hello
So, you want to add a number of lines varibale. This sounds like a job for the SUM function. AMOUNT of work on numbers, no channels such as time, so use TO_NUMBER to convert strings to numbers, so you can add them. If you want to display the result as a string, you can use TO_CHAR to convert the sum into a string.
WITH got_total_minutes AS
(
SELECT SUM ((TO_NUMBER (SUBSTR (heure, 1, 2) * 60)))
+ TO_NUMBER (SUBSTR (hour 4))
) AS total_minutes
OF time_duration
)
SELECT TRUNC (total_minutes / 60). ':'
|| To_char (MOD (total_minutes, 60))
, "FM00.
) AS total_hours_minutes
OF got_total_minutes
;
The output is not quite what you asked:
TOTAL_HOURS_MINUTES
--------------------
30: 28
If you really want 30:38', explain how to get it.
This solution assumes that time always is always 5 characters (2 digits, a separator and another of 2 digits) as it is in your sample data.
If your actual data aren't like your sample data, the same approach still works, but the SUBSTR expressions will be more complicated.
adnanBIH wrote:
Dear professionals,
I use Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production. I stored length of certain events in the table TIME_DURATION as as follows (format h24:mi):
- CREATE TABLE 'TIME_DURATION' ('ID' NUMBER (11.0), VARCHAR2 (5)) 'HOUR '.
- Insert into TIME_DURATION (ID, TIME) values ('5',' 00:55 ');
- Insert into TIME_DURATION (ID, TIME) values ('7',' 00:18 ');
- ...
Thanks for posting the CREATE TABLE and INSERT.
ID is a NUMBER, so do not use quotes around it:
Insert into TIME_DURATION (ID, TIME) values (5, ' 00:55 ');
Insert into TIME_DURATION (ID, TIME) values (7, ' 00:18 ');
...
Depending on how you plan to use the hour, you may want to store a NUMBER, also, or maybe an INTERVAL DAY TO SECOND.
-
How does the sum function in the element tag?
Hello!
I am new to XML Publisher and I need help to understand how my definition of data.
In my xml file, I have this piece of code
and now, I have problem with element with functions sum, because it returns like for example. 21356,15. all other components (COST, YTD_DEPRN, DEPRN_RESERVE, DEPRN_RESERVE_BY, NET_VALUE) return values such as 21356.15.<group name="G_ACCOUNT" source="Q_REGISTER"> <element name="COST_ACCOUNT" value="COST_ACCOUNT"/> <element name="ACC_DESC" value="ACC_DESC"/> <element name="YEAR" value="YEAR"/> <group name="G_COST" source="Q_REGISTER"> <element name="COST_CENTER" value="COST_CENTER"/> <group name="G_TAG_NUMBER" source="Q_REGISTER"> <element name="TAG_NUMBER" value="TAG_NUMBER"/> <element name="ASSET_NUMBER" value="ASSET_NUMBER"/> <element name="DESCRIPTION" value="DESCRIPTION"/> <element name="ASSET_ID" value="ASSET_ID"/> <element name="ASSET_NUMBER" value="ASSET_NUMBER"/> <element name="COST" value="COST" dataType="number"/> <element name="YTD_DEPRN" value="YTD_DEPRN" dataType="number"/> <element name="DEPRN_RESERVE" value="DEPRN_RESERVE" dataType="number"/> <element name="DEPRN_RESERVE_BY" value="DEPRN_RESERVE_BY" dataType="number"/> <element name="NET_VALUE" value="NET_VALUE" dataType="number"/> <element name="DPIS" value="DPIS"/> </group> <element name="SUM_ACCOUNT_COST" function="sum" dataType="number" value="G_TAG_NUMBER.COST"/> <element name="SUM_ACCOUNT_YTD_DEPRN" function="sum" dataType="number" value="G_TAG_NUMBER.YTD_DEPRN"/> <element name="SUM_ACCOUNT_DEPRN_RESERVE" function="sum" dataType="number" value="G_TAG_NUMBER.DEPRN_RESERVE"/> <element name="SUM_ACCOUNT_DEPRN_RESERVE_BY" function="sum" dataType="number" value="G_TAG_NUMBER.DEPRN_RESERVE_BY"/> <element name="SUM_ACCOUNT_NET_VALUE" function="sum" dataType="number" value="G_TAG_NUMBER.NET_VALUE"/> </group> </group>
Can you tell me why sum function does not return to the same value?
Kind regards
drama9346As I expected wrong since this isn't a RAW number his tent for formatting. You can change this value and format or just go for the sum of RTF, or the SUM of your SQL query.
Sum in RTF: for SUM_ACCOUNT_COST
I have given how you use grouping in this case, based on what you might change the code slightly.
Published by: amri on 9 April 2013 14:28
-
Somewhere is the sum of control or digital sign for firefox windows install?
Hello
Somewhere is the sum of control or digital sign for firefox windows install?Latest version of Firefox on the CDN server:
- [1020249/questions/1020249] How to use the SHA512SUMS. CSA
-
How to set a Total sum only for the newly added lines
Hi Experts,
JDeveloper 12.1.3.0.0
Hi I have a table and above, I have an Add button. During the click on Add I only show new lines using CreateWithParams.
Existing or rescued lines that I went under certain conditions as false. So, how can I calculate the sum of the salary only for new lines and display it in the column Footer.
Thank you
Roy
One approach would be to browse all lines and sum of lines in the getter for the variable 'total '.
http://adfcodebits.blogspot.com/2010/04/bit-4-iterating-view-object-using.html
Dario
-
Need to sum over all coulumns except for the needs of a coulumn max value
Hi gurus,
I have a requirement like:
I have 3 columns C1, c2, c3.
Day 1, Records values are 100,150,200
The day2 Records values are 100,150,300
End result... for the column C1 and C2, I should get sum of them
so the result for C1 according to the above values: 200
C2 = 300
But for column C3, I should get only the maximum value... like 300 (not money)...
Tuition assistance box by setting a flag on the date of the report max... We can do this... Are there others that it is possible. (End ETL or SPR or before)
Thank you.For C3 column rather than display all values like 200, 300, just to show the max value only until you capturing below as and when you sum of value remain 300. Give it a try. It can be by RPD or in the report.
Day 1, Records values are 100,150,300
The day2 Records values are 100,150,300so much sense check
Thank you
-
Change the label after you check the sum of calculation for the column
Hi all
I have a crosstab report and I checked the 'sum of calculation' for each column and the total at the bottom. The label is 'full report '. How to change this label?
Thanks in advance!On the attributes page of the report, in the region to break the formatting, you can put your text into the field "Display this text when printing of money to report".
Maybe you are looking for
-
I can no longer access my work because you have disabled SSLv3
I need to be able to access the site of mytupperware.ca ! Your new version of Firefox won't let me and is more annoying because it is a part of my JOB!
-
How to wipe & restore PH3100U-1EXB to factory default configured using Vista?
The partition was accidentally deleted during Vista re - install on the laptop, now the partion of virtual cd is not readable. :( There is no critical data on this drive.
-
Satellite T110 - Toshiba tools do not work on Windows 7 Ultimate
I just received my service with a new hard drive on this netbook. of course, no OS on it. On a soft x 64 Windows 7ultimate I have updated the BIOS to the version posted here for my kind of netbook. right now all of his work properly except. Eco utili
-
I was wondering the best way to deal with the non-standard fonts used in a project CVI? I have an application that uses the "SWAstro" font for the up and down arrows as indicators in a table of the CVI. When you run the executable file on a compute
-
How can I update my license on my computer?
How can I update my license on my acer aspire one d257 runing windows xp family