473,387 Members | 1,597 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,387 software developers and data experts.

Ordering Sums

Hello, I have a query which sums check boxes (so 0 or -1) then Abs the
sum so i can get the number of check box 'checked' per column... based
on start and end date.

SELECT Abs(Sum(CommCon)) AS [Communication Content Error],
Abs(Sum(PerfWor)) AS [Performance Seems Worse], Abs(Sum(AppPCWor)) AS
[Application or PC not Working], Abs(Sum(PrinPeriph)) AS [Printer or
Peripheral Problems], Abs(Sum(VPNWor)) AS [Wireless,VPN not Working],
Abs(Sum([MissApp])) AS [Missing Application], Abs(Sum(SerRes)) AS [Does
not like Service Restriction], Abs(Sum(SWAT)) AS [SWAT Problem],
Abs(Sum(CommRec)) AS [Comm Not Received], Abs(Sum(MissDat)) AS [Missing
Data], Abs(Sum(SupProb)) AS [Support Problem], Abs(Sum(MissSite)) AS
[Missing Site], Abs(Sum(Reboot)) AS [Unhappy about Reboot Intrpts],
Abs(Sum(Font)) AS [Font/Settings], Abs(Sum(PDA)) AS [PDA Problem],
Abs(Sum(Misc)) AS Miscs
FROM [Input] INNER JOIN DSAT ON Input.[Input ID] = DSAT.[Input ID]
WHERE (((Input.[Start Time])>=[Enter Start Date (mm/dd/yyyy)] And
(Input.[Start Time])<=[Enter End Date (mm/dd/yyyy)]));
My question is there a way to order the sums so that the highest number
is on the top (or left) and the lower is underneath ...
Does that make sense? I attempted to use Group By, but doesnt work,
how would i implement order by?

Sep 18 '06 #1
8 1674
Save your query, create a new query based on it and ORDER BY that one.

You can safely do -Sum() instead of Abs(Sum), that may give a tiny
performance increase :)

Dr******@gmail.com schreef:
Hello, I have a query which sums check boxes (so 0 or -1) then Abs the
sum so i can get the number of check box 'checked' per column... based
on start and end date.

My question is there a way to order the sums so that the highest number
is on the top (or left) and the lower is underneath ...

Does that make sense? I attempted to use Group By, but doesnt work,
how would i implement order by?
--
Bas Cost Budde
Holland
Sep 18 '06 #2

Bas Cost Budde wrote:
Save your query, create a new query based on it and ORDER BY that one.
I'm still a bit confused on how to do this ... I have the query saved
.... but i can't 'order by' a "*" , so how do i get all the columns in
order???

Sorry if this is an easy fix :-/

Sep 18 '06 #3
Here's another question:

This output of the query gives me each number in a row ... doesn't
'group by' apply to columns?? can i even sory a row of data?

So my output it each Sum() has a column and produces on one row with
all the numbers. Can this be done?

If not, suggest a new way to do the calculations?!

Dr******@gmail.com wrote:
Bas Cost Budde wrote:
Save your query, create a new query based on it and ORDER BY that one.

I'm still a bit confused on how to do this ... I have the query saved
... but i can't 'order by' a "*" , so how do i get all the columns in
order???

Sorry if this is an easy fix :-/
Sep 18 '06 #4
I seem to have overlooked a feature of your question. You have several
sums in one row, and want to sort the *columns*. That cannot be done
with SQL.

You can, however, produce a large UNION of the sums, much like this:

first create a helpquery that puts your FROM and WHERE at bay:
[helpquery]
SELECT * FROM [Input] INNER JOIN DSAT ON Input.[Input ID] = DSAT.[Input ID]
WHERE (((Input.[Start Time])>=[Enter Start Date (mm/dd/yyyy)] And
(Input.[Start Time])<=[Enter End Date (mm/dd/yyyy)]))

then have a large set of UNIONS:

SELECT Abs(Sum(CommCon)), "Communication Content Error" FROM helpquery
UNION SELECT Abs(Sum(PerfWor)), "Performance Seems Worse" FROM helpquery
UNION SELECT Abs(Sum(AppPCWor)), "Application or PC not Working" FROM
helpquery
UNION SELECT Abs(Sum(PrinPeriph)), "Printer or Peripheral Problems" FROM
helpquery

and so on; in the end you can do
ORDER BY 1
meaning the first column. The second column will show your value label.

Dr******@gmail.com schreef:
Here's another question:

This output of the query gives me each number in a row ... doesn't
'group by' apply to columns?? can i even sory a row of data?

So my output it each Sum() has a column and produces on one row with
all the numbers. Can this be done?

If not, suggest a new way to do the calculations?!

Dr******@gmail.com wrote:
>Bas Cost Budde wrote:
>>Save your query, create a new query based on it and ORDER BY that one.
I'm still a bit confused on how to do this ... I have the query saved
... but i can't 'order by' a "*" , so how do i get all the columns in
order???

Sorry if this is an easy fix :-/
--
Bas Cost Budde
Holland
Sep 18 '06 #5
As a matter of fact, I have studied ordering fields by row values
before. See my site, under Code Modules/News Questions, the question
'sort record fields'.

http://www.heuveltop.BasCB/msac_index.html
--
Bas Cost Budde
Holland
Sep 18 '06 #6
I will have to give that a try!!! Thanks soo much!!

Also: *** the link you provided is broken *** Please repost, as i am
very interested in your studies!!

Thanks again!

Bas Cost Budde wrote:
As a matter of fact, I have studied ordering fields by row values
before. See my site, under Code Modules/News Questions, the question
'sort record fields'.

http://www.heuveltop.BasCB/msac_index.html
--
Bas Cost Budde
Holland
Sep 18 '06 #7
Dr******@gmail.com wrote:
Also: *** the link you provided is broken *** Please repost, as i am
very interested in your studies!!
Try http://www.heuveltop.nl/BasCB/msac_index.html

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200609/1

Sep 19 '06 #8
Indeed. <scratchhow did it arrive at lowercase?

Granny Spitz via AccessMonster.com schreef:
Dr******@gmail.com wrote:
>Also: *** the link you provided is broken *** Please repost, as i am
very interested in your studies!!

Try http://www.heuveltop.nl/BasCB/msac_index.html
--
Bas Cost Budde
Holland
Sep 19 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: guyzdancin | last post by:
I have developed a parsing program to handle large csv files and compute sums. The program was developed and successfully tested using only String objects. I want replace String objects with ...
2
by: Ken Fine | last post by:
(originally posted to one of macromedia's groups; no help, so hopefully someone here can help me out. I'm using VBScript ASP.) When designing administrative interfaces to websites, we often need...
15
by: Kay Schluehr | last post by:
Here might be an interesting puzzle for people who like sorting algorithms ( and no I'm not a student anymore and the problem is not a students 'homework' but a particular question associated with...
2
by: masood.iqbal | last post by:
What is the standard C/C++ lexicograhic ordering of punctuation characters with respect to each other and the alphanumeric characters? --Masood
2
by: D. Dante Lorenso | last post by:
First I created a function that selected the next available pin code from a table of pre-defined pin codes: CREATE FUNCTION "public"."get_next_pin_code" () RETURNS varchar AS' DECLARE...
2
by: Ken Durden | last post by:
Is there any way to control ordering of items in intellisense via attributes? For example, I have the following enum: public enum ESeverity { Acceptable, Low, Medium,
33
by: Benjamin M. Stocks | last post by:
Hello all, I've heard differing opinions on this and would like a definitive answer on this once and for all. If I have an array of 4 1-byte values where index 0 is the least signficant byte of a...
1
by: wisemen | last post by:
I have a table with 2 columns, and .I want to run a query that will give me a cumulative sum of the no. of entries that have an <= and on the second column give me a cumulative sum of the no. of...
4
ChrisWang
by: ChrisWang | last post by:
Dear all, I am reading the book "Core Python Programming". In the chapter talking about modules, it says the modules should follow this ordering: import Python Standard Library modules ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.