[AccessD] Sub Query Assistance Requested

jack drawbridge jackandpat.d at gmail.com
Tue Nov 29 13:52:35 CST 2011


Chester,
Try

SELECT Count(A.PID) AS [Active Flowing Count],EngArea
FROM
(SELECT DISTINCT A.PID, EngArea
FROM [tbl Statuses During Prior Month] AS A
WHERE(A.Status In ("FL","FM","FH")))
Group by EngArea;

On Tue, Nov 29, 2011 at 9:41 AM, Kaup, Chester <
Chester_Kaup at kindermorgan.com> wrote:

> I have the following query that works correctly returning a result of 8
>
> SELECT Count(A.PID) AS [Active Flowing Count]
> FROM (SELECT DISTINCT A.PID
> FROM [tbl Statuses During Prior Month] AS A
> WHERE(A.Status In ("FL","FM","FH")));
>
> I would also like to return the field EngArea from the table
> [tbl Statuses During Prior Month] also. Would that be possible and if so
> how? My attempts so far have failed.
>
> Result should be something like this
> Active Flowing Count    EngArea
> 3                               1
> 1                               2
> 4                               3
>
> Thanks.
>
> Chester Kaup
> Engineering Technician
> Kinder Morgan CO2 Company, LLP
> Office (432) 688-3797
> FAX (432) 688-3799
>
>
> No trees were killed in the sending of this message. However a large
> number of electrons were terribly inconvenienced.
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list