On Sat, Sep 20, 2008 at 08:45:16AM +0400, Alexander Batyrshin scratched on the 
wall:
>  Hello everyone,
> 
> I gets strange result from this query on SQLite-3.6.2
> 
> SELECT
>             town.id, town_log.new_player_id, player.name
> FROM
>             town_log
>             LEFT JOIN town
>             LEFT JOIN player
> ON
>             town.id = town_log.town_id AND town_log.new_player_id = player.id
> WHERE
>             town_log.id = 5195

  "ON" is part of a JOIN operation.  You have two JOINs but only one ON,
  and it is only getting applied to the second JOIN.

  I think you want something closer to this:
  
...
FROM
        town_log 
        LEFT JOIN town ON town.id = town_log.town_id
        LEFT JOIN player ON town_log.new_player_id = player.id
WHERE
        town_log.id = 5195



  -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Our opponent is an alien starship packed with atomic bombs.  We have
 a protractor."   "I'll go home and see if I can scrounge up a ruler
 and a piece of string."  --from Anathem by Neal Stephenson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to