[Web4lib] ODBC query in PHP

Darryl Friesen Darryl.Friesen at usask.ca
Fri Dec 15 00:36:10 EST 2006


> The query is:
>
> $query = "SELECT bib_text.title_brief, bib_index.bib_id FROM bib_text,
> bib_index WHERE  bib_index.bib_id=bib_text.bib_id AND
> bib_index.index_code LIKE '%655%' AND bib_index.display_heading LIKE
> '%Thesis%' AND bib_text.bib_format LIKE 'tm'" ;

Two thoughts:

1) your last condition has no wildcards, so LIKE doesn't make sense there.
Should it be

       bib_text.bib_format='tm'

  or did you mean

       bib_text.bib_format='%tm%'


2) Does Oracle care how you write your JOIN?  Does it work any better if you
write the query like this:

  SELECT bib_text.title_brief, bib_index.bib_id FROM bib_text INNER JOIN
bib_index ON bib_index.bib_id=bib_text.bib_id WHERE (bib_index.index_code
LIKE '%655%') AND (bib_index.display_heading LIKE '%Thesis%') AND
(bib_text.bib_format LIKE '%tm%')


- Darryl

 ----------------------------------------------------------------------
  Darryl Friesen, B.Sc., Programmer/Analyst    Darryl.Friesen at usask.ca
  Information Technology Services Division,     http://gollum.usask.ca/
  University of Saskatchewan Library
 ----------------------------------------------------------------------
  "Go not to the Elves for counsel, for they will say both no and yes"



More information about the Web4lib mailing list