Kai Peters wrote:
I do have an audit table with this structure:

AuditID
ChangeDate
RowID           (foreign/primary key in TableName)
ActionType TableName

and I want to query for records pertaining to a certain table name within a 
given changedate range.
I do, however, only want to receive the last (ChangeDate) record in cases where more than one record per rowid exist.

Any help appreciated,

You will need to use a subquery to do what you want, because you want to do a join on the results of a group by. This is one example of syntax:

  select * from audtbl where (RowID, ChangeDate) in
    (select RowID, max(ChangeDate) as ChangeDate from audtbl group by RowID);

-- Darren Duncan

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to