RE: [PHP] odbc_exec

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: RE: [PHP] odbc_exec
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-26555@lists.php.net to get a copy of this message
Hello Andrew, I hope that is not the case. First I used a query analyzer to generate the results, just to make sure the execution does not result to an infinite loop. The query analyzer returned only 10 resluts (as an example). When I used the same query within odbc_exec and echoed the results, it echoed too many results(4000), i.e. redundant rows(values). Is there by any chance a query analyzer's results be different from that of odbc_exec's execution(results) when both have the same query? Thank you. Bernie (suggestion kept) On Tue, 21 Nov 2000, Andrew Hill wrote: > Date: Tue, 21 Nov 2000 08:13:55 -0500 > From: Andrew Hill <ahill@openlinksw.com> > To: bernie terrado <bbt@teamyehey.com>, php-general@lists.php.net > Subject: RE: [PHP] odbc_exec > > Hi Bernie, > > At first guess, you probably have generated what is called a 'cartesian > product' e.g. you are joining improperly. > > To verify, add a "distint" clause: (select distinct table1.field from ....) > If this returns the correct number of records, I would rearrange your select > via something like: > > select table1.field from table1, table2 where table1.id = table2.id and > table1.id = "value"; > > You can also try (depending on if your driver/database support SQL92) > something like > > select table1.field from table1 natural join table2 where table1.id = > "value" or > select table1.field from table1 join table2 on table1.id = table2.id and > table1.id = "value"; > > Hope this helps. > > Best regards, > Andrew > ---------------------------------------------------- > Andrew Hill > Director Technology Evangelism > OpenLink Software > http://www.openlinksw.com > XML & E-Business Infrastructure Technology Provider > > > > -----Original Message----- > > From: bernie terrado [mailto:bbt@teamyehey.com] > > Sent: Tuesday, November 21, 2000 1:34 AM > > To: php-general@lists.php.net > > Subject: [PHP] odbc_exec > > > > > > I have a problem.... > > > > it's about odbc_exec > > > > $topicgenquery = odbc_exec($conn,"select something.columns from tbl1 join > > tbl2 on tbl1.id = tbl2.id and tbl1.id =value;"); > > > > one odd thing i've noticed is it returns more than what it is supposed to > > have queried. > > > > There were only 13 rows to be returned but it returned 4002! > > > > Have encountered this kind of problem? > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > >

« previous php.general (#26555) next »