日期:2014-05-17 浏览次数:20558 次
CREATE TEMPORARY TABLE a (id int, bid varchar(10), content varchar(10));
INSERT INTO a VALUES('1','1,5,2','AAAAAAA');
INSERT INTO a VALUES('2','2,4','AAAAAAA');
INSERT INTO a VALUES('3','1,3,2','AAAAAAA');
CREATE TEMPORARY TABLE b (bid int, content varchar(10));
INSERT INTO b VALUES('1','BBBBB');
INSERT INTO b VALUES('2','BBBBB');
INSERT INTO b VALUES('3','BBBBB');
INSERT INTO b VALUES('4','BBBBB');
INSERT INTO b VALUES('5','BBBBB');
select a.id, b.bid as bid, a.content, b.content as bcontent
from a, b
where find_in_set(b.bid, a.bid)
order by a.id