有谁知道是否可以在一个查询中执行以下操作而不是执行 numrows?
$select1 = "SELECT service FROM UPSServices WHERE code = '$serviceCode' AND ship_from_code = '$shipFrom'";
$result = mssql_query($select1);
//print_r($result);
if(mssql_num_rows($result) == 0) {
$select2 = "SELECT service FROM UPSServices WHERE code = '$serviceCode' AND ship_from_code IS NULL";
$result = mssql_query($select2);
}
while ($service = mssql_fetch_array($result)) {
return $service['0'];
}