Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access 2007 Queries

Posted on 2013-06-07
5
Medium Priority
?
446 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 93

Accepted Solution

by:
Patrick Matthews earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

610 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