Solved

Access Query

Posted on 2004-08-04
11
249 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
ID: 11716346
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
ID: 11716359
SELECT * FROM yourtablename WHERE [FileNumber] = TRUE
0
 
LVL 8

Expert Comment

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

Expert Comment

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

Author Comment

by:YZlat
ID: 11716543
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 8

Expert Comment

by:arcross
ID: 11716661
jaja veo que controlas español YZlat
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 11716683
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
ID: 11716781
jajaja was he your real friend?

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

Author Comment

by:YZlat
ID: 11717006
yo creo que no:)
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 11717177
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
ID: 11718590
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views 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 Access…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

920 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

12 Experts available now in Live!

Get 1:1 Help Now