Re: [sqlite] Can this be done in one query?

2012-09-09 Thread Darren Duncan
Petite, well yes, the syntax you gave, subquery in the from clause, is functionally equivalent to the one I gave; either way we are returning the foo records that match the result of the subquery. In other words, I agree with you, and could have written it the way you did, but I considered my

Re: [sqlite] Can this be done in one query?

2012-09-09 Thread Petite Abeille
On Sep 9, 2012, at 6:51 AM, Darren Duncan wrote: > 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

Re: [sqlite] Can this be done in one query?

2012-09-08 Thread Darren Duncan
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

Re: [sqlite] Can this be done in one query?

2012-09-08 Thread Igor Tandetnik
Kai Peters wrote: > 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. A very similar problem was

Re: [sqlite] Can this be done in one query?

2012-09-08 Thread Simon Slavin
On 9 Sep 2012, at 5:19am, 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

[sqlite] Can this be done in one query?

2012-09-08 Thread Kai Peters
Hi all, 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