Friday losing it: JOINS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I 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=TXT_TAGHM_migration_HM_mini_2G_0507

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux