Query

P

Pass-the-Reality

I have a table that contains Agent Number. In my query, I have a pop up that
ask "What is Social Number". If the Social Number that is entered matches an
Agent Number in the table, I want the query to return the Agent Number.
However, if the Social Number matches, the query is returning 2 lines. A
blank line and then the Agent Number. How do I get the query to return just
the Agent Number? I have to Group By due to the fact there are duplicate
Agent Numbers in the table.

SELECT IIf([What is Social Number?]=[AGENT NUMBER],[AGENT NUMBER]) AS Response
FROM CallSheetEntry
GROUP BY IIf([What is Social Number?]=[AGENT NUMBER],[AGENT NUMBER]);
 
D

Douglas J. Steele

SELECT [AGENT NUMBER]
FROM CallSheetEntry
WHERE [AGENT NUMBER] = [What is Social Number?]

or, to remove duplicates,

SELECT DISTINCT [AGENT NUMBER]
FROM CallSheetEntry
WHERE [AGENT NUMBER] = [What is Social Number?]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top