Calculating Mode.

J

JMSatMetro

I tried posting this question in the Query specific portion of this
discussion board with no answers....

I've got a query which produces a recordset that I'd like to extract the
statistical mode of for a particular field. But not the mode of ALL records,
but the mode for each unique fkFranchiseID. Therefore, I need a subquery.

My primary query is:

SELECT tblOriginTAZ.fkFranchiseID, qryArcUniverseMin.TAZd,
tblFacilities.Facility
FROM (qryArcUniverseMin INNER JOIN tblOriginTAZ ON qryArcUniverseMin.TAZo =
tblOriginTAZ.TAZo) INNER JOIN tblFacilities ON qryArcUniverseMin.TAZd =
tblFacilities.TAZd
ORDER BY tblOriginTAZ.fkFranchiseID;

.....that I'd like to write a subquery on the TAZd field such that it
extracts the MODE TAZd for each fkFranchiseID.

So, the subquery would look something like:

SELECT tblOriginTAZ.fkFranchiseID, qryArcUniverseMin.TAZd,
tblFacilities.Facility
FROM (qryArcUniverseMin INNER JOIN tblOriginTAZ ON qryArcUniverseMin.TAZo =
tblOriginTAZ.TAZo) INNER JOIN tblFacilities ON qryArcUniverseMin.TAZd =
tblFacilities.TAZd

WHERE qryArcUniverseMin.TAZd = SELECT <<SQL implementing mode???>> AS T
WHERE T.fkFranchiseID = [qryAcrUniverseMin].fkFranchise
ORDER BY tblOriginTAZ.fkFranchiseID;

What now do I put in place of the <<SQL implementing mode???>> piece???!!!!!
 

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

Top