+ -
当前位置:首页 → 问答吧 → 请教如何从两组数中选出相同的数??

请教如何从两组数中选出相同的数??

时间:2010-11-28

来源:互联网

比如有两个数据。A有:1,2,3,4,5,6,7,8,9 B有:1,5,8,10,11,12,13我想用SQL语句把两组数中相同的1,5,8选出来,语句是什么?多谢!

作者: bihairen   发布时间: 2010-11-28

$a=array(1,2,3,4,5);
$b=array(2,3,8);
foreach($a as $value){
       if (in_array($value,$b)){
              echo $value;
       }
}

作者: kelon   发布时间: 2010-11-28

"select * from table where colomA = colomB";

作者: lyl198659   发布时间: 2010-11-28

引用:
原帖由 bihairen 于 2010-11-28 14:12 发表
比如有两个数据。A有:1,2,3,4,5,6,7,8,9 B有:1,5,8,10,11,12,13我想用SQL语句把两组数中相同的1,5,8选出来,语句是什么?多谢!
人家要sql语句。。。

作者: lyl198659   发布时间: 2010-11-28