[AccessD] Query does not return all records

David McAfee davidmcafee at gmail.com
Wed Jan 12 12:56:36 CST 2011


If you change the HAVING line to read >#1/1/2001#, do you get 1039 records?

Are any PID fields null? If so, you may have to use the following

ON NZ(dbo_DSS_StatusChanges1.PID,0) = NZ(dbo_DSS_CompletionMaster.PID,0)



On Wed, Jan 12, 2011 at 9:08 AM, Kaup, Chester <
Chester_Kaup at kindermorgan.com> wrote:

> The following query only returns 1046 records even though the table
> dbo_CompletionMaster has 2085 distinct records. What am I doing wrong?
> Thanks.
>
> SELECT dbo_DSS_CompletionMaster.PID, dbo_DSS_CompletionMaster.Well_Number,
> Last(dbo_DSS_StatusChanges1.StatusDate) AS LastOfStatusDate
> FROM dbo_DSS_StatusChanges1 RIGHT JOIN dbo_DSS_CompletionMaster ON
> dbo_DSS_StatusChanges1.PID = dbo_DSS_CompletionMaster.PID
> GROUP BY dbo_DSS_CompletionMaster.PID, dbo_DSS_CompletionMaster.Well_Number
> HAVING (((Last(dbo_DSS_StatusChanges1.StatusDate))<#1/1/2001#));
>
>
> 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