I changed to this:
select a.id, b.id
from AA a, BB b
where a.id like concat('%',b.id,'%')
and it seems working now.
But I got another problem in the stored procedure:
I wrote a procedure which has two IN parameters which are two rows' IDs in two tables. I tested the procedure on the console which works fine. But when I use PHP to pass in all rows' IDs in a loop, it no longer finds the row. I checked the loop and those two ID values do pass in, but it just does not work any more.
Here is some part of the procedure code:
CREATE PROCEDURE AD_book(IN AD_id varchar(30), IN book_id varchar(30))
insert into today_found_book
select a.id, c.id, c.courseName, c.title, c.edition
from AD_book a, book c
where a.uniq_id = AD_id and c.uniq_id = book_id and
c.courseName like concat('%',courseN,'%')
and
c.title like concat('%',tit,'%')
and
c.otherInfo like concat('%',otherInf,'%') and
c.edition like concat('%',edi,'%') ;
I tested it on the console:
call AD_book('410a151500be6', '40f0753af2225');
and one row will be shown on the result table.
But when I use PHP to go throug two tables' rows and pass in all row IDs, it doesn't work anymore.
This thing really puzzled me. Could someone help me this? Thanks a lot.