[PHP-DEV] Bug #3989: some joins fail to work properly From: mattw <email protected>
Date: 03/30/00

From: mattw <email protected>
Operating system: Red Hat Linux 6.1
PHP version: 3.0.15
PHP Bug Type: ODBC related
Bug description: some joins fail to work properly

Using IBM DB2 for Linux, I ran the following query:

select A.name as alpha, B.name as bravo
from table1 A, table1 B, table2 C
where C.ref1 = A.id1 and C.ref2 = B.id2

Notice that table1 is pulled from twice, once as A and once as B. table2 (C) has two fields (ref1 and ref2) that each references one entry in table1.

Using odbc_fetch_into() (or, alternatively,
odbc_fetch_row()/odbc_fetch_result() ) causes the fields alpha and bravo to contain the same value. (Basically, the data that comes from table1 aliased as A is *also* set as the data from table1 aliased as B.)

In other words, if I pull the data into an associative array, the values

$array["alpha"]

and

$array["beta"]

return the same value, even if they are different in the database. I tried pasting the query into the DB2 command line tool, and it works correctly (i.e. alpha and beta do not return the same value).

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>