Pedro Janssen
pedro at plex.nl
Tue Sep 28 14:10:20 CDT 2010
Hello Gustav and Chester, thanks for the help. I will try this tomorrow. I'll hope will hope for large numbers of records. But i still need the subquery for counting measures. May be there is a work around for this counting. If i don't manage it by myself, i will get back to the list for help. Rocky, Patientnr is indexed. Thanks Pedro Op 28-9-2010 17:28, Gustav Brock schreef: > Hi Pedro > > Why not just: > > SELECT > Patientnr, > Max(UitvoerDatum) As UitvoerDatumLast > FROM > qryKreatinine > GROUP BY > Patientnr; > > /gustav > > >>>> pedro at plex.nl 28-09-2010 17:04>>> > Dear List, > > i have a query<qryKreatinine> with about 400000 records. > This query contains patientnumbers and dates > > > <qryKreatinine> > Patientnr UitvoerDatum > 01000616 1-6-2009 > 01000616 29-7-2009 > 01000661 1-5-2010 > 01000661 3-6-2010 > 01000661 3-6-2010 > 01000832 11-9-2009 > 01000832 17-9-2009 > 01000832 1-3-2010 > > I need to have for each Patientnumber, the last date (see final result). > I did this with two queries (see below), but only with low number queries (a few thousand records. > With more then 500000 records it takes to much time to get the result. > > Can i do this with 1 query in a normal time span for 400000 records?? > > > Thanks > > Pedro > > >