[AccessD] SQL Time

Stuart McLachlan stuart at lexacorp.com.pg
Tue Dec 11 15:30:13 CST 2012


Something like:

 Select t1.* from mytable t1
inner join
(select distinct ParentFK, INT(rDateTime), max(rDatetime) as lasdatetime
   group by ParentFK, INT(rDateTime)) t2
on t2.ParentFK = t1.ParentFK 
AND t2.lastdatetime = t1.rdatetime

The inner Select should return the FK and the datetime of the last record for each day for 
each Parent entity.  Joining on those two fields should give you just the records you want.

-- 
Stuart

On 11 Dec 2012 at 20:58, Kaup, Chester wrote:

> I have a database with linked SQL server table. I need to extract some
> records from the table. Some days there is more than one record; ie
> two records with different times. I need to grab the last record on
> those days. So far I have not come up with a way. Your ideas
> appreciated. -- 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