Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Query

Status
Not open for further replies.

Dedicated

Programmer
Dec 26, 2003
38
US
Nested query - I had to search employee's name under 2 seperate criterias...I named the fields in the query [Emp1] and [Emp2]. Now since I have the correct info I need to create another query with a single field which combines the names together. So, I need a list of all employees from both [Emp1] to [Emp2] into a single field. I am lost on how to do this. Withthe queries I created I kept getting a -1 instead of a character.

Emp1: IIf(([Empl2Name]<>[EmployeeN]) Or ([CaseC]=-1) And ([Empl2Name]=True),[Empl2Name],0)

Emp2: IIf(([EmployeeN]=True) And ([Empl2Name] Is Null) And ([CaseC]=-1),[EmployeeN],0)

Any help is greatly appreciated.



 
It sounds like you need a UNION query.

If I understand your desired output, a simple UNION query may look something like this...
Code:
SELECT [i]fieldname[/i] FROM EMP1
UNION
SELECT [i]fieldname[/i]FROM EMP2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top