时间:2021-07-01 10:21:17 帮助过:11人阅读
$arr=array('tom','cat','jam','tim','bim');
tom,cat,tony,girl
jam,tim,bim
jam,tom
tool,wood,boy,cat
$sql = 'create temporary table T ';
foreach($arr as $i=>$v) {
$sql .= $i ? "union select '$v' " : "select '$v as name ";
}
mysql_query($sql); //创建临时表
$sql = "select * from tbl_name, T where find_in_set(T.name, tbl_name.field)";
$rs = mysql_query($sql); //查询