Friday losing it: JOINS
am 20.07.2007 19:03:22 von Instruct ICCI have a 1 table query which returns less rows than when I have a 2 table
query using an implicit inner join or an explicit left join.
Select some, fields
From table1
Where part like '123%'
/* returns 2225 rows */
Select activePart, some, fields
From table1, table2
Where part like '123%'
and part = activePart
/* implicit inner join returns 2270 rows */
Select activePart, some, fields
From table1 left join table2
On part = activePart
Where part like '123%'
/* explicit left join also returns 2270 rows */
Fields part and activePart are not in table2 and table1 respectively.
I assume I am forgetting something basic this friday. Why would I get more
rows from the above? I might expect more rows from an outer join. Am I
writing an outer join?
After a quick break in the john, I'm thinking perhaps table2 is not holding
unique "part"s as I was told it would. But I'll post this for your thoughts
before I check on that, in case you have other insights.
____________________________________________________________ _____
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TX T_TAGHM_migration_HM_mini_2G_0507
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php