"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=w2.Lang AND w.Rev<w2.Rev
>    WHERE w2.Id IS NULL

select * from Words where not exists (
  select * from Words w2
  where Words.Id = w2.Id and Words.Lang=w2.Lang and Words.Rev<w2.Rev
);

-- or

select * from Words where Rev = (
    select max(Rev) from Words w2
    where Words.Id = w2.Id and Words.Lang=w2.Lang);

> 3)  Which of the following two queries is more efficient (Ie. is
> it better to have the w.Id=527 before or after the WHERE keyword)?

I doubt it makes any difference.

Igor Tandetnik



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

Reply via email to