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 gr
"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 resul
"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
>
>
> 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, Lang
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:
>
"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 w.Lang
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 w.Revhttp://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
7 matches
Mail list logo