A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Agents and sub Agents in a query



 
 
Thread Tools Display Modes
  #1  
Old January 18th, 2006, 06:59 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Agents and sub Agents in a query

Hi,

I've Orders and Agents tables joint in a query. The Agents table has
AGENT_ID and MNGR_ID. The query pulls the monthly orders per Agent. Some
Agents have sub Agents and I differentiate them with the MNGR_ID. So what I
need to accomplish is to pull the orders of all the Agents and sub Agents
but, the latter, should be grouped as an Agent having MNGR_ID = 35.

I cannot seem to accomplish such task. I'd appreciate some help.

TIA

Inma


  #2  
Old January 19th, 2006, 04:29 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Agents and sub Agents in a query

Hi,


If you need to regroup together the data about "Constantinople", "Byzance"
and "Istanbul", you can make a table about that:

akas ' table name

This aka ' fields name

Constantinople Istanbul
Byzance Istanbul
Bytown Ottawa
Lutecia Paris

.... 'data sample



Then, the query:

SELECT Nz(aka, givenName) As city, COUNT(*)
FROM myOriginalData LEFT JOIN akas
ON myOriginalData.givenName = akas.this
GROUP BY Nz(aka, givenName) As city


should do the appropriate "count"

In your case, it is not city but employee id, but the principle is the same,
from what I understand.



Hoping it may help,
Vanderghast, Access MVP


"Inma" wrote in message
...
Hi,

I've Orders and Agents tables joint in a query. The Agents table has
AGENT_ID and MNGR_ID. The query pulls the monthly orders per Agent. Some
Agents have sub Agents and I differentiate them with the MNGR_ID. So what
I need to accomplish is to pull the orders of all the Agents and sub
Agents but, the latter, should be grouped as an Agent having MNGR_ID = 35.

I cannot seem to accomplish such task. I'd appreciate some help.

TIA

Inma




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.