473,725 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Counting Records with Criteria

4 New Member
In my database, I am trying to count records from a [Stratum] field that meet the criteria of "[Days}<42". Below is my SQL query code.

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCTROW WARes016.Stratum, Count(([WA Res 016 Final Selection].[Days])) AS CountOfDays
  2. FROM WARes016 INNER JOIN [WA Res 016 Final Selection] ON WARes016.LRS = [WA Res 016 Final Selection].LRS
  3. GROUP BY WARes016.Stratum, [Days]<42
  4. ORDER BY WARes016.Stratum;
This code when run breaks the count into two groups:a count of [Days] per Stratum that meet my criteria and a count of records that don't.

How do I alter the code to only show the count of records that meet my criteria? Or am I going about this all wrong? I am really new at this.

I would appreciate any feedback!

Thank you!
Apr 9 '07
10 2997
NeoPa
32,569 Recognized Expert Moderator MVP
NeoPa - that fixed it and it now counts correctly! Yay! Thank you and everyone else so much for your help!
That NeoPa is something, isn't he?
I'm pleased that worked for you - Thanks for letting us know :)
Thanks ADezii, coming from a respected peer that means a lot :)
Apr 18 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

8
1741
by: Brenda J. | last post by:
Hello all I'm sure this is a relatively simple query to create, but I can't seem to get my head around it. Here is an example of the two tables I am using: tblAccountTypes AccountTypeID AccountType AccountNumberRange
13
1507
by: Tony Williams | last post by:
I have a query that I want to count the number of records where the value of a field "txtFactClients" is not 0. I have set up an expression "CountFC: txtFactClients" with Count selected in the Total line and >0 in the criteria line but when I run the query it counts every record whether or not it is 0. I've looked at previous post but they all seem to involve SQL, is there a way of doing this in the design mode of a query? TIA Tony
5
1822
by: chrisc | last post by:
Hello, Hope this is the right place for this... I am creating a testing database for components as they come off a production line. My reports need to select faults that are found, as well as pass or fails dependent on a batch number.
5
3506
by: ChadDiesel | last post by:
Hello Again, I want to assign a number to each record that will be part of a shipping number. I want the number value to count up until the contract number changes. Then, I want the number to go back to 1 and start counting up again until the next contract change. For example Contract 1111111 Box 1 of 2 Number Value: 1
1
1397
by: teddyparnell | last post by:
I have a query which selects a number of names from a table, which abide with the criteria. I then want another query to select where the names appear more than three times when the previous query is run, would i use the count function and how would i go about it? Cheers for any suggestions
1
1948
by: geronimo_me | last post by:
Hi, I have a query that has the following fields: Business: ID Number: LastName: EmpNo: Hours1: Hours2:
1
2141
by: Joseph Berry | last post by:
I have created a report drawing from one table. What I would like to is, grouping by one field, count the number of records within the group that meet two selection criteria (i.e., Field1="A" and Field2="1"). How do I go about doing that? Many thanks!
21
2553
by: jennwilson | last post by:
Ok - So, I am back. I would like to count the number of times a specific record appears in a field from one table in my query and then use that value in the same query to calculate an average. I am using Access 2000 and am still learning. Background info: Overall, I am creating a database to track and calculate data regarding employee productivity. For each scheduled day, employees have a set number of points to earn. Employees...
1
3733
by: RussCRM | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for statistical purposes. I've been using Here’s the situation: I have two main tables: Guest (stores data such as GuestID, First Name, Last Name, etc.) and Services (stores data such as the type of service the guest used (Shelter Bed, Lunch, Dinner,...
0
8752
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
9401
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
9111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8096
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
6011
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4517
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
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
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
3
2157
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.