On 20 Feb 2012, at 4:11pm, Puneet Kishor <punk.k...@gmail.com> wrote:

> is there are way to force the query to return only the "first" match so the 
> resulting query has only as many rows as the left table?

You have two problems:

A) You are JOINing two columns which contain some null values.  null is 
interpreted as 'I don't know', so the joins tend to match many different rows.

B) You are using a LEFT JOIN which is explicitly defined to include many 
matches, not just one match.  Instead you might try NATURAL JOIN or CROSS JOIN 
to see what difference they make.

And you have a meta-problem too: the dataset you're experimenting with is so 
big you can't see why it's doing what it's doing.  It might be useful for you 
to make up a little test database with perhaps 5 rows in each table, just so 
you can look through every row and see what's going on.

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

Reply via email to