RE: [PHP] odbc_exec
| From: | Andrew Hill | Date: | Tue, 21 Nov 2000 13:13:55 +0000 |
| Subject: | RE: [PHP] odbc_exec | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26436@lists.php.net to get a copy of this message | ||
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
>
>
>