473,804 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Basic query question regarding parameters and grouping.

I often want to query the database with certain parameters in my query
which I do not want included in the query result.

The problem is when I want to group on 1, sum the 2nd (and group by)
and use a parameter on the 3rd (but don't want to group by it). For
example, I might want all records later than a certain date, but don't
want to group on the date. In the past I've made 2 queries, the first
choosing the records with the date parameter, the second doing the
grouping. I was wondering whether there was a better way.... a more
enlightened path that I could pursue...

Cheers

Reg

Jan 4 '06 #1
1 1451
In query design view, you have already depressed the Total icon on the
toolbar, and so you have a Total row in your query.

In the Total row under the date field, choose WHERE, and add the criteria
beneath that.

The WHERE clause is applied before grouping (i.e. only to the inital
selection process.) If you use Group By in the Total row, JET groups on the
field and applies the criteria to the total (the HAVING clause when you
switch to SQL View.)

Declaring the parameters (Parameters on Query menu) is always a good idea.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Regnab" <p.*******@gmai l.com> wrote in message
news:11******** ************@g4 7g2000cwa.googl egroups.com...
I often want to query the database with certain parameters in my query
which I do not want included in the query result.

The problem is when I want to group on 1, sum the 2nd (and group by)
and use a parameter on the 3rd (but don't want to group by it). For
example, I might want all records later than a certain date, but don't
want to group on the date. In the past I've made 2 queries, the first
choosing the records with the date parameter, the second doing the
grouping. I was wondering whether there was a better way.... a more
enlightened path that I could pursue...

Cheers

Reg

Jan 4 '06 #2

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

Similar topics

5
4382
by: Bruno Alexandre | last post by:
Hi guys, withou using SP, I want to be able to add a Parameter to the SQL Query and retrive the Recordset so I can use the Paging property under the recorset object.... how can I do this? I'm stuck here.
5
2257
by: Jerome | last post by:
Hi, I've got the following problem: I want my ASP page to display a certain number (based on a COUNT query), it works fine if the result is at least 1! If there are no records to be counted (= the query is empty), I get errors. What I've tried is this:
5
3394
by: KGuy | last post by:
I have a question on a practice assignment that I can't solve. Can someone help me out? Question: The table Arc(x,y) currently has the following tuples (note there are duplicates): (1,2), (1,2), (2,3), (3,4), (3,4), (4,1), (4,1), (4,1), (4,2). Compute the result of the query: SELECT a1.x, a2.y, COUNT(*)
7
2060
by: jane | last post by:
HI, I was ask to do a query to get the member active condition I had table to show the member number and active status in three month. ACC A1 A2 A3 ---- ----------- ----------- ----------- c001 1 1 1
8
1743
by: Yisroel Markov | last post by:
I have the following in my code: strSQL = "SELECT tblTransactions.PshpID, tblTransactions.TransDate, " _ & " Sum(tblTransactions.DDAmount) AS SumDDAmount FROM tblTransactions " _ & "INNER JOIN tblMonthly ON tblTransactions.PshpID = tblMonthly.PshpID " _ & "WHERE tblTransactions.TransDate BETWEEN #12/31/03# AND #05/31/04# " _
1
1446
by: AJ | last post by:
Folllowing on from a previous post, i have created a stored query as follows. SELECT c.ID, c.Company_Name, p., 1 As QueryNbr FROM (Company AS c LEFT JOIN Sale AS s ON c.ID = s.Company_ID) LEFT JOIN Package AS p ON s.Package_ID = p.ID WHERE c.Category = 'EXH'
4
1470
by: technobob | last post by:
I have what seems to be a strange situation. I have a table where Sales are recorded. Most of the time there is only a primary salesman involved (Salesman1). When there is a secondary salesman, the reporting for that sale (i.e. estimated Gross, Units ect) are split in half. The problem arises when I have to give the other salesman the other half. For reporting purposes, sales are totaled and grouped by salesman on a monthly basis. It...
2
1133
by: Grant Schenck | last post by:
Hello, I'm a Win32/Forms developer and have to do a little ASP. So, the requirement is that I need to build an ASP.NET solution. I built it using I guess standard ASP.NET in that get a request and generate updates to the page as a result. This was all pretty easy. Now, the requirement is actually to handle a request like this:
6
38533
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get through this without much trouble. Programming knowledge is not required. Index What is SQL? Why MySQL? Installing MySQL. Using the MySQL command line interface
0
9714
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
9594
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,...
0
10600
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10350
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10351
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
9174
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...
0
5534
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
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3002
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.