Solved

Access Query

Posted on 2004-08-04
11
248 Views
Last Modified: 2012-05-05
I have a table with three fields:

RecordID - Auto number
FileNumber - Numeric String
Validated - Boolean

I need to write a query to select the count of file numbers that were not validated i.e where Validated=False.
The trick is that there are could be multiple records for the same file number. And if a file number has a record where Validated=True it does not need to be counted. For example:

RecordID      FileNumber      Validated
1            123            True
2            123            False
3            123            True
4            456            False
5            678            False
6            678            False

The query should return 2
0
Comment
Question by:YZlat
  • 5
  • 3
  • 3
11 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 50 total points
Comment Utility
say your table is called xxx

select count(FileNumber) from xxx a where validated=false and recordid not in (select recordid from xxx where xxx.filenumber = a.filenumber and validated=true)


0
 
LVL 8

Expert Comment

by:arcross
Comment Utility
SELECT * FROM yourtablename WHERE [FileNumber] = TRUE
0
 
LVL 8

Expert Comment

by:arcross
Comment Utility
im crap. forget my comment. I had a brain attack
0
 
LVL 8

Expert Comment

by:arcross
Comment Utility
select  count(FileNumber) as  MyFileNumber from table1 WHERE FileNumber = TRUE and Validate=FALSE
0
 
LVL 35

Author Comment

by:YZlat
Comment Utility
arcross, que pasa contigo?:)

rockiroads,

filenumber needs to be unique, so I changed your query to:

select count(FileNumber) from xxx a where validated=false and FileNumber not in (select distinct FileNumber from xxx where xxx.filenumber = a.filenumber and validated=true)



0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 8

Expert Comment

by:arcross
Comment Utility
jaja veo que controlas español YZlat
0
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
onions, thats the only spanish I know (sorry bad joke)

and one other line, which a mexican friend of mine told me

chupa me ver..... thats enough now

sorry people, my spanish aint that good
0
 
LVL 8

Expert Comment

by:arcross
Comment Utility
jajaja was he your real friend?

hmmm, or maybe (HE) was (SHE) what it makes the difference ;)
0
 
LVL 35

Author Comment

by:YZlat
Comment Utility
yo creo que no:)
0
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
his name was Ernie, I know him when I used to stay in Banning in California (at school) one of the first guys I got to know when I started school there

he did tell me the meaning and also another slight variation to it, but thats it

0
 
LVL 35

Author Comment

by:YZlat
Comment Utility
that's how I learned:)
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now