Solved

Access 2007 Queries

Posted on 2013-06-07
5
430 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

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. …
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

738 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