473,499 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using GroupBy, Min, Max, and Count in the same Query

I have noticed something odd on one of my queries. Maybe someone can
help or explain.

I am using the GroupBy function on all my rows except for pulling "Min"
StartDate, "Max" EndDate, and "Min" StartTime and "Max" StartTime.

Problem is though, when I also pull "Count" on the Enrolment column, in
the same query, I notice the Enrolment count is double or triple what
it is suppose to be. It looks like I can use either Min/Max, or Count,
but not both in the same query. Is this an SQL rule, or an Access
limitation? Is there a way around this?

Marcus
******

Nov 13 '05 #1
2 3052
There is no such limitation. You can use any and all
aggregation functions in one query. Could you post the
query? Could you be querying two or more tables with an
incomplete join?

Kevin
Marcus<to*******@yahoo.ca> 4/12/2005 6:23:39 AM >>>

I have noticed something odd on one of my queries. Maybe
someone can
help or explain.

I am using the GroupBy function on all my rows except for
pulling "Min"
StartDate, "Max" EndDate, and "Min" StartTime and "Max"
StartTime.

Problem is though, when I also pull "Count" on the
Enrolment column, in
the same query, I notice the Enrolment count is double or
triple what
it is suppose to be. It looks like I can use either
Min/Max, or Count,
but not both in the same query. Is this an SQL rule, or an
Access
limitation? Is there a way around this?

Marcus
******

Nov 13 '05 #2
Luckily enough I was able to solve the problem. I simply created two
queries: one query with the enrolment column (using an aggregate
"count"), which excluded the date/time table; and the other query
pulling the start date, end date, and start time, and end time (using
the "Min" and "Max" aggregates), excluding the enrolment column.

I then created a third query which joined the first two queries via a
section_id column. I then extracted the date,time, and enrolment
columns in the new query.

All worked out well.

Marcus
*********

Nov 13 '05 #3

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

Similar topics

6
11477
by: Nicolae Fieraru | last post by:
Hi All, I have a query, Select Count(BoolField) from tblMyTable, Where BoolField = true. If I run the query by itself, it returns the number of true records I want to use the result of that...
6
10196
by: Access Newbie | last post by:
I'm using Access 2000 and I'm trying to create a pass-through query to append all the data from a local table to a remote table. I'm using the SQL query editor in MS Access to create the query (I...
0
1308
by: elie chucrallah | last post by:
Dear Sirs, I have the following select query and i need to update the field EmailLastReceivedDate (showing null in the select) to the values in the field MaxOfSentOn using access 2000 query ...
12
22764
by: briansmccabe | last post by:
Does anyone have a good approach to displaying in PHP a simple COUNT query that is performed on a table in a MySQL db? Thanks
6
5041
by: dBNovice | last post by:
Hey group, I am trying to do a count of the number of papers in a table. The table has a PaperID that differentiates each paper , e.g. 004.1. Some papers are reused. The reused paper is given...
6
4800
by: Peter Herath | last post by:
I want to create a dynamic report using a crosstab query...... pls someone look into my attached example database and help me out to do the report generation.... example is like dis...: there...
3
1733
by: prabhas | last post by:
I want to swap two tuples in a table, using a single , simple query. No SELECT query allowed, no inner queries allowed. No PL/SQL allowed. Do you have any idea how to do this? e.g. my current...
3
4823
WyvsEyeView
by: WyvsEyeView | last post by:
This seems like it should be so easy to do. I have a table, called tblTopics. Each topic can have one or more instances, contained in a table called tblTopicInst. tblTopics is bound to a form called...
1
2176
by: shoaib kahn | last post by:
i am developing a web site in Asp.Net using Visual Studio 2008. i want to know that how can i search a keyword that will be entered by the user, i want the key word should be searched in complete...
9
2557
by: omar999 | last post by:
hi guys im a little stuck - how would I join this query select *,isnull(price_band_1,0)+isnull(price_band_2,0)+isnull(price_band_3,0)+isnull(price_band_4,0)+isnull(price_band_5,0) as pricesum ...
0
7134
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
7014
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7229
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.