Re: [sqlite] Three LEFT JOIN issues

2008-07-03 Thread Csaba
On Thu, Jul 3, 2008 at 1:33 PM, Igor Tandetnik <[EMAIL PROTECTED]> wrote: > "Csaba" <[EMAIL PROTECTED]> wrote in > message > news:[EMAIL PROTECTED] >> SELECT * FROM Words >> GROUP BY Id, Lang >> HAVING Rev=Max(Rev) > > This wouldn't do what you think it does. HAVING clause applies to the > whole

Re: [sqlite] Three LEFT JOIN issues

2008-07-03 Thread Igor Tandetnik
"Csaba" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > SELECT * FROM Words > GROUP BY Id, Lang > HAVING Rev=Max(Rev) This wouldn't do what you think it does. HAVING clause applies to the whole group, not to individual rows. It determines whether the group makes it into final

Re: [sqlite] Three LEFT JOIN issues

2008-07-03 Thread Igor Tandetnik
"Csaba" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > However, MySQL (at least this is what I recollect from about > 4 years ago) takes the tack that it will provide a 'representative' > row from each such class where no aggregate function is > specified for a non GROUP BY field >

Re: [sqlite] Three LEFT JOIN issues

2008-07-03 Thread Csaba
> As this applies to my query, it would be: > SELECT * FROM Words > GROUP BY Id, Lang, Rev > HAVING Rev=Max(Rev) Drat. That Rev shouldn't be in the GROUP BY. The query I wanted to write is: SELECT * FROM Words GROUP BY Id, Lang HAVING Rev=Max(Rev) > Given that I have my Primary Key as (Id,

Re: [sqlite] Three LEFT JOIN issues

2008-07-03 Thread Csaba
On Tue, Jul 1, 2008 at 2:53 PM, Igor Tandetnik <[EMAIL PROTECTED]> wrote: > "Csaba" <[EMAIL PROTECTED]> wrote in > message news:[EMAIL PROTECTED] >> 1) In the following LEFT JOIN, is it possible to alter >> the query so that there is no w. prefix at the >> beginning of each returned column name:

Re: [sqlite] Three LEFT JOIN issues

2008-07-01 Thread Igor Tandetnik
"Csaba" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 1) In the following LEFT JOIN, is it possible to alter > the query so that there is no w. prefix at the > beginning of each returned column name: > > SELECT w.* FROM Words AS w LEFT JOIN Words as w2 >ON w.Id=w2.Id AND

[sqlite] Three LEFT JOIN issues

2008-07-01 Thread Csaba
1) In the following LEFT JOIN, is it possible to alter the query so that there is no w. prefix at the beginning of each returned column name: SELECT w.* FROM Words AS w LEFT JOIN Words as w2 ON w.Id=w2.Id AND w.Lang=w2.Lang AND