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

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 1421
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.*******@gmail.com> wrote in message
news:11********************@g47g2000cwa.googlegrou ps.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
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...
5
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...
5
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),...
7
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 ---- -----------...
8
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...
1
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...
4
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,...
2
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...
6
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...
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: 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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
0
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...

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.