i have two tables that share a common (i call it a "matching") field named "acct." i would like to be able to do something like the following:

SELECT * from db1, db2
WHERE db1.acct like db2.acct;

i am fairly new to mySQL, but i have created an index for db1.acct and for db2.acct thinking that indices would speed up the search. but, when i did an EXPLAIN on the previous SELECT statement, mySQL didn't show any index information.

so, is it possible to create a "spanning" index of sorts that will help mySQL not choke on a query that spans two tables?

    would i really use = when the fields are varchar?

      thank you VERY much for this insight. a query that was locking my machine up yesterday is now completing quickly.

      can anyone tell me why "=" works (and uses the index), while "like" doesn't?

      thanks again.

        Write a Reply...