P
Patti Schreiber
Hi,
I am trying to write a query that returns the top 25 percent of multiple
fields. I have achieved the query I want by adding a rank coulmn in Excel,
but I want to skip this step. Here is the query that achieves the results
that I want.
SELECT [13L].[file name], [13L].[sum rank], [13L].[gage rank]
FROM 13L
WHERE ((([13L].[sum rank])<(SELECT Count([13L].[file name])/4 FROM 13L)) AND
(([13L].[gage rank])<(SELECT Count([13L].[file name])/4 FROM 13L)));
Without having added the sum rank and gage rank fields, I have acheived the
top 25 percent return for one field using the following:
SELECT TOP 25 PERCENT [13L].[file name],[13L].[sum], [13L].[gage],
FROM 13L
ORDER BY [13L].sum;
The problem is, I want to narrow down the results to return only those in
which the entry is in the top 25 percent of both the gage and the sum field.
I have attempted the following subquery, with the dreaded error 3306 (EXISTS
reserved keyword...) :
SELECT [13L].[file name], [13L].[sum rank], [13L].[gage rank]
FROM 13L
WHERE (([13L].[file name]) = (SELECT TOP 25 PERCENT [13L].[file
name],[13L].[sum] FROM 13L ORDER BY [13L].sum));
My question is how to achieve the results I want using subqueries, or is
there someway to easily create my rank field (calculate in a query an ordered
field) in Access?
I am trying to write a query that returns the top 25 percent of multiple
fields. I have achieved the query I want by adding a rank coulmn in Excel,
but I want to skip this step. Here is the query that achieves the results
that I want.
SELECT [13L].[file name], [13L].[sum rank], [13L].[gage rank]
FROM 13L
WHERE ((([13L].[sum rank])<(SELECT Count([13L].[file name])/4 FROM 13L)) AND
(([13L].[gage rank])<(SELECT Count([13L].[file name])/4 FROM 13L)));
Without having added the sum rank and gage rank fields, I have acheived the
top 25 percent return for one field using the following:
SELECT TOP 25 PERCENT [13L].[file name],[13L].[sum], [13L].[gage],
FROM 13L
ORDER BY [13L].sum;
The problem is, I want to narrow down the results to return only those in
which the entry is in the top 25 percent of both the gage and the sum field.
I have attempted the following subquery, with the dreaded error 3306 (EXISTS
reserved keyword...) :
SELECT [13L].[file name], [13L].[sum rank], [13L].[gage rank]
FROM 13L
WHERE (([13L].[file name]) = (SELECT TOP 25 PERCENT [13L].[file
name],[13L].[sum] FROM 13L ORDER BY [13L].sum));
My question is how to achieve the results I want using subqueries, or is
there someway to easily create my rank field (calculate in a query an ordered
field) in Access?