>I know I can use the Notes.timecol field to pull the date
Actually, no you can't. The TimeCol column only contains the
time of the last note. The date portion is in DateCol. So even if you use
SELECT MAX(DateCol) AS MaxDate, MAX(TimeCol) AS MaxTime
you still won't get the result you want because MaxTime will return the highest time in that column regardless of the date. Therefore, if you have two notes
2004/12/03 11:53
2005/02/04 09:21
then the preceding query would return
2005/02/04 11:53
which does not correspond to either of those notes. In Pervasive.SQL the query you seek would look something like this:
SELECT
Client_Id,
Contact_Number,
MAX(
TIMESTAMPADD(
SQL_TSI_SECOND,
(HOUR(TimeCol)*3600)+(MINUTE(TimeCol)*60)+SECOND(TimeCol),
CONVERT(DateCol,SQL_TIMESTAMP)
)
) AS LastNoteTimestamp
FROM "AMGR_Notes"
GROUP BY Client_Id, Contact_Number
HTH, Gord
Reporting Geek and author of the CreateUdfViews utility
http://www.regensys.com/CreateUdfViews