473,785 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query Conflict


I am using MS Office Access 2003 (11.5614). I have been running the
following query with good results. The query lets me enter the month
period and returns the SUM of the age fields.

SELECT [Enter Month/Year as mm/yyyy] AS [Month/Year], SUM([0 to 18])
AS [Sum of 0 to 18], SUM([19 to 40]) AS [Sum of 19 to 40], SUM([41 to
65]) AS [Sum of 41 to 65], SUM([66 Plus]) AS [Sum of 66 Plus]
FROM [Lake Worth CFP Clients]
WHERE FORMAT([SvcDate 1],"mm/yyyy")=[Enter Month/Year as mm/yyyy];

I now want to add an additional criteria of the city field. I added
the criteria with the SQL results
..
SELECT [Enter Month/Year as mm/yyyy] AS [Month/Year], Sum([0 to 18])
AS [Sum of 0 to 18], Sum([19 to 40]) AS [Sum of 19 to 40], Sum([41 to
65]) AS [Sum of 41 to 65], Sum([66 Plus]) AS [Sum of 66 Plus]
FROM [Lake Worth CFP Clients]
WHERE (((Format([SvcDate 1],"mm/yyyy"))=[Enter Month/Year as mm/yyyy])
AND (([Lake Worth CFP Clients].City)="Lake Worth"));

I get the following error message:

You tried to execute a query that does not include the specified
expression "city" as part of an aggregate function.

The conflict appears to be between the city criteria and the SUM of
the ages.

Can anyone give me some direction in this matter ?

Sep 29 '07
11 1845
Michael Gramelspacher <gr******@psci. netwrote in
news:ng******** *************** *********@4ax.c om:
There was a discussion of this on m.p.sqlserver.p rogramming only a
few days ago on the 24th, Question regarding "HAVING COUNT(*)=0".

What I got out of it was that using an aggregate function without
a GROUP BY clause means there is just one single group. Thus,
HAVING is appropriate.

That's what I had been led to believe too, from a different source,
and personal experience.
>
On Sat, 29 Sep 2007 16:54:38 -0500, "David W. Fenton"
<XX*******@dfen ton.com.invalid wrote:
>>I still don't get why you need a HQAVING because you have no GROUP
BY clause.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Sep 30 '07 #11
Michael Gramelspacher <gr******@psci. netwrote in
news:ng******** *************** *********@4ax.c om:
On Sat, 29 Sep 2007 16:54:38 -0500, "David W. Fenton"
<XX*******@dfe nton.com.invali dwrote:
>>I still don't get why you need a HQAVING because you have no GROUP
BY clause.

There was a discussion of this on m.p.sqlserver.p rogramming only a
few days ago on the 24th, Question regarding "HAVING COUNT(*)=0".

What I got out of it was that using an aggregate function without
a GROUP BY clause means there is just one single group. Thus,
HAVING is appropriate.
Only if you're putting criteria on the *result* of an aggregate.
that was not the case in the example given, where the criterion was
on a field *not* being aggregated.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Sep 30 '07 #12

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

Similar topics

5
1935
by: ~greg | last post by:
I have links on an index page like this: <a href="link" onclick="DoOnClick('link')"> page title </a> -where the DoOnClick("link") just adds a query part to the url before executing: location.href = "link?query"; ( this is done in order to maintain certain state information
0
1465
by: Conner | last post by:
Hi Bob, I know this reply is a little late for you but I just came accross your post. You might be interested to know that there is a pretty good query tool available on download.com called Universal Table Browser. It is a multi-database enterprise level query tool and I have been able to open data sets that contain literally millions of records in a matter of seconds with it.
4
11366
by: Max Harvey | last post by:
Hi, I have looked at the example called "Open Parameter queries from code" from the site http://www.mvps.org/access/queries/qry0003.htm I made up a test which I though looked pretty close (which I will paste below) I have put it on the BeforeUpdate event of a form I am using, but whenever it is called, I get "Run-time error '13':, Type mismatch
1
1566
by: Johm | last post by:
In my query, consisting of 2 tables, customers and orders,i get the employeeid number ordered with a given customer. The query is the following : SELECT orders.orderid, Customers.Customerid, Customers.EmployeeID FROM orders INNER JOIN Customers ON orders.customerid = Customers.Customerid; If i add on another table in the query, the tables Employees, then my query
2
1845
by: LoopyNZ | last post by:
Hi, (Access 97) I'm creating a query (QRY_SUMMARY) to join a query (QRY) to itself (QRY_1). I'm returning QRY.* and selected fields from QRY_1. With each field (field_name) I return from QRY_1 I'm appending "_1" to to the end to avoid name conflicts with the fields from QRY, i.e. "field_name" becomes "field_name_1".
10
2111
by: Robert | last post by:
I am an attorney in a non-profit organization and a self-taught programmer. I'm trying to create a client db that will allow me to search for potential conflicts of interest based either on Social Security # or on Last Name. I've created two different tables with the following fields in each table: ClientInfo Client# (primary key) First Name Middle Name Last Name
1
2449
by: lorirobn | last post by:
Hi, I have a query that I have been using as a record source for a form with no problems. I just created a new "addnew" form, and added 20 records to the table with this form. The problem I now have is I cannot modify data on these new records using my query. The query's sql is: SELECT tblSpaceUse.* FROM tblSpaceUse; The error I get is: "Write Conflict -
4
3134
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and can not get that query to work. I thought I might be able to accomplish the results in two steps by using two queries. If this is possible how can I do it? Thank you, Stan Hanna
14
6905
lotus18
by: lotus18 | last post by:
Hello all I have these records on my Day Table for my complete database table please click here 1. M 2. T 3. W 4. TH 5. F 6. S
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9485
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10098
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8986
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7506
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4058
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3662
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.