//分解字符串,如果你是要找这两个数据的话
$oldstring="100-200";
$newstring=explode("-",$oldstring);
$a=$newstring['0'];
$b=$newstring['1'];
$sql="select * from cp where XX='$a' or XX='$b'";
//如果是要找他们之间的东东
$sql="select * from cp where XX between $a and $b";
if ($a>$b){
$sql="selecet xxx from xx where xx<=$a and xx>=$b";
}else if($a==$b){
$sql="selecet xxx from xx where xx='$a'";
}else{
$sql="selecet xxx from xx where xx<=$b and xx>=$a";
}