473,320 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

calculation between 2 queries

2
Query#1:
select cd_fm_rgn_npl,
sum(amt_ls_estd)as amt_ls_estd,
sum(amt_ls_estd_in_mllns) as amt_ls_estd_in_mllns
from udbadm.mol_npl_ls_hst
where dt_rptg_per_npl = '08/31/2006'
group by cd_fm_rgn_npl

Query #2
select cd_fm_rgn_npl,
amt_ls_estd,
amt_ls_estd_in_mllns
from udbadm.mol_npl_ls_all_ppty_hst where cd_npl_ls_rpt_type = 3 and
dt_rptg_per_npl = '08/31/2006' order by cd_fm_rgn_npl

How do I do calculation between these two queries?
I want to subtract sum(amt_ls_estd) from query 1
from amt_ls_estd from query 2.
Oct 28 '06 #1
2 1548
bharad
7
Details are skimpy, can you provide more?

Query#1:
select cd_fm_rgn_npl,
sum(amt_ls_estd)as amt_ls_estd,
sum(amt_ls_estd_in_mllns) as amt_ls_estd_in_mllns
from udbadm.mol_npl_ls_hst
where dt_rptg_per_npl = '08/31/2006'
group by cd_fm_rgn_npl

Query #2
select cd_fm_rgn_npl,
amt_ls_estd,
amt_ls_estd_in_mllns
from udbadm.mol_npl_ls_all_ppty_hst where cd_npl_ls_rpt_type = 3 and
dt_rptg_per_npl = '08/31/2006' order by cd_fm_rgn_npl

How do I do calculation between these two queries?
I want to subtract sum(amt_ls_estd) from query 1
from amt_ls_estd from query 2.
Nov 1 '06 #2
masdi2t
37
u can solve ur problem using stored-procedure (only if u're using mysql5)
Nov 3 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: anaxamandr | last post by:
Hi. I have a long loop in ASP that performs a rather lengthy calculation. I would love for my users to be able to stop that calculation, if they so choose, mid way through the process. I attempted...
1
by: rc | last post by:
reposting from comp.database.ms-access "rc" <robert.cipriani@us.army.mil> wrote in message news:ayLtc.27697$0X2.969222@twister.tampabay.rr.com... > I have a table with a single record that...
6
by: Gary | last post by:
I have an example table with fields and records as shown below: RECORD_ID DATE PRODUCT QUANTITY 1 4/1/05 widget1 50 2 4/2/05 widget1 48 3 ...
4
by: Michiel Alsters | last post by:
Hello everybody, I hope anybody can help me. I'll try to give a brief overview of my problem. I have running a program that performs a heavy calculation. To give the user feedback what the...
6
by: jimfortune | last post by:
In: http://groups.google.com/group/comp.databases.ms-access/msg/60d7faa790c65db1 james.ea...@gmail.com said: :Ok, I've answered the first half of my own question. From a MSDN :article, I...
3
by: laurentc via AccessMonster.com | last post by:
Hi. I have an issue with my Access project. I have rather big tables of data (about 11 000 rows). These tables are historical product quotations, so they are very simple : - MyDate...
3
by: ApexData | last post by:
Hello My MainForm manages Employee records. I have created another form that manages employee promotions. On the MainForm a button launches the PromotionForm and lists the promotions for the...
5
by: The alMIGHTY N | last post by:
Hi all, Let's say I have a simple math formula: sum (x * y / 1000) / (sum z / 1000) I have to do this across 50 items, each with an x, y and z value, when the page first loads AND when a...
1
by: c8tz | last post by:
This is a query I have created that picks up the top 3 dates for this data (for example) : Tree Pos2 Date 1 15 23/08/2005 1 20 12/02/2006 1 32 15/10/2006 ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.