Littlemalky
Board Regular
- Joined
- Jan 14, 2011
- Messages
- 223
Hi, I have a question on how to build this query so that it functions correctly. I am most familiar with building queries with the objects rather than direct SQL so I think that's where I need help. I am working in Access 2013 for reference.
I have table "tbl_TERRITORY", with two fields [TERRITORY_ID] and [TERRITORY_DESCRIPTION]. I'm joining this on a table that maps a sales employee to each territory (this is a one to many relationship, as there can be multiple sales employees per territory). Table name is "tbl_TERRITORY_EMPLOYEE_MAP", with the following relevant fields [TERRITORY_ID], [EMPLOYEE_ID], and [SALES_ROLE_ID].
My join is on [TERRITORY_ID], naturally. What I'd like to display is a list of all the territories with the corresponding sales employees where [SALES_ROLE_ID] equals 1 in one column. Then in the next column I want to list, again, all of the employees where [SALES_ROLE_ID] equals 2.
Can this be done in the same query, or would I have to build a union?
I have table "tbl_TERRITORY", with two fields [TERRITORY_ID] and [TERRITORY_DESCRIPTION]. I'm joining this on a table that maps a sales employee to each territory (this is a one to many relationship, as there can be multiple sales employees per territory). Table name is "tbl_TERRITORY_EMPLOYEE_MAP", with the following relevant fields [TERRITORY_ID], [EMPLOYEE_ID], and [SALES_ROLE_ID].
My join is on [TERRITORY_ID], naturally. What I'd like to display is a list of all the territories with the corresponding sales employees where [SALES_ROLE_ID] equals 1 in one column. Then in the next column I want to list, again, all of the employees where [SALES_ROLE_ID] equals 2.
Can this be done in the same query, or would I have to build a union?