473,326 Members | 2,108 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,326 software developers and data experts.

sum of two column and divide that sum in a single statement how it is ppossible..?

i have a sql query single statement ,sum of the two columns and their division of the same two sum columns in same query
display after division result

like

a column ,b column
select (sum(a)/sum(b))from table
i ran this on getting "right paranthis error"
Nov 30 '13 #1
1 4189
dgunner71
110 100+
ram12345,

I'm not 100% certain that I understand what you're trying to accomplish but you will likely want to change the query type to show totals (on the design tab). Then change the total value from 'Group By' to 'Sum' for both columns.

If you want to perform division on this value in the query, I believe you'll have to create a second query as I don't think you can perform a calculation directly on an aggregated value in the same query.

The second query would pull the values in from the first query and the divide them there.

If you don't need the query, you can probably skip the second query and just get both values using 2 separate dlookups. (or dsums to skip the totals function).

dim dblValue1 as double
dim dblValue2 as double
dim dblNewValue as double

dblValue1 = dlookup("[sumofValueA]","qryMyQuery")
dblValue2 = dlookup("[sumofValueB]","qryMyQuery")
dblNewValue = dblValue1 / dblValue2

Gunner
Nov 30 '13 #2

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

Similar topics

5
by: hobo | last post by:
I have this query that I would rather not turn into a stored proc. because the client really has no budget. I was hoping there would be a way to add this statement inline to the following sql with...
0
by: dmr | last post by:
can any one help me to reversing the bits in a byte/word in a single statement?
10
by: Sorawit Sharp | last post by:
My app executes C# user scripts via dynamic code execution. Is it possible to execute the scripts single step wise like a debugger ?
1
by: davidevan | last post by:
What I'm trying to do is set a players division according to their age. So if age is 8, update division to junior, if age is 9, update division to medium, if age is 10, update division to pee wee,...
1
jenkinsloveschicken
by: jenkinsloveschicken | last post by:
Is it possible to compare a single value to many in a single statement? Here is what I am attempting to do: 1. Users lands on page and via a cookie check function they are identified. 2. A query...
1
by: siddu | last post by:
How to call Javascript function in single statement, I have to call these two statements in a single onClick img.Attributes("onclick") = "toggleSidebar(" + IDPREFIXSIDEBARCONTENT + CStr(tab.Id) +...
2
by: semomaniz | last post by:
I was able to combine three columns with following sql statement but the problem that i am having is if one of the column has a null value the concatenation does not work and the sql statement does...
2
by: vikramkumar | last post by:
I have two arrays,i want to take out common elements from those two arrays in a single statement, for example ; two arrays are my @a = (1, 3 ,4 ,7 ); my @b = (2 , 3 ,6 , 7); i want to...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.