Solved

Access 2007 Queries

Posted on 2013-06-07
5
417 Views
Last Modified: 2013-06-07
I have a table that lists 100 employees information. One of the fields is a number code, which has many diff codes for some employees. The specific code I want is "001".

I know how to make the query work for just that code, it returns 50 employees.

Here is what I want. A query that will return all employees with the 001 code and the employees that dont have the 001 code.
0
Comment
Question by:CMILLER
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39229479
<employees that dont have the 001 code. >

here is the query for employees that dont have the 001 code

select *
from TableName
where [code field] <> "001"
0
 

Author Comment

by:CMILLER
ID: 39229622
I need one query that returns employees with the 001 code, which currently is 50 employees. I need the same query to return the other 50 employees that dont have the 001 code.

I have ten codes ( 001-010 ). All employees have atleast one of the ten codes.

My resulting query needs to return all 100 employees but I only need to know about the 001 code.
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 39229658
>>My resulting query needs to return all 100 employees

Then why not simply use:

SELECT * FROM [TableName]

:)

Or is this what you mean:

SELECT *, IIf([the_code] = "001", "Has 001", "Not 001") AS [Whatever]
FROM [TableName]
0
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 39229679
<<<<<Here is what I want. A query that will return all employees with the 001 code and the employees that dont have the 001 code.>>>>

Wouldn't that be the same as selecting all employees from your table .... sorted by your code field????


ET
0
 

Author Closing Comment

by:CMILLER
ID: 39229767
Matthew,

Thanks, this is what I needed, just didnt know how to explain it.

SELECT *, IIf([the_code] = "001", "Has 001", "Not 001") AS [Whatever]
FROM [TableName]
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This collection of functions covers all the normal rounding methods of just about any numeric value.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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.

813 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

15 Experts available now in Live!

Get 1:1 Help Now