tp3.2原生sql拼接查询
发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,//获取搜索结果 $sql = "SELECT * FROM `br_esf_village_price` p,(SELECT villageId,MAX(updateTime) m
千家信息网最后更新 2026年11月03日tp3.2原生sql拼接查询
//获取搜索结果
$sql = "SELECT * FROM `br_esf_village_price` p,(SELECT villageId,MAX(updateTime) max_time FROM br_esf_village_price GROUP BY villageId) as b,br_esf_village v WHERE p.villageId= b.villageId AND p.updateTime=b.max_time AND v.villageId = p.villageId ";
if($condition['qy']){ //区域
$sql .= "and fangAreaId = ".$condition['qy']." ";
}
if($condition['qy']){ //商圈
$sql .= "and fangTradingId = ".$condition['sq']." ";
}
if($condition['jg'] || $condition['zdyjg']){ //价格
$temp = array();
$temp = $condition['zdyjg'] ? explode(",",$condition['zdyjg']) : explode(",",$condition['jg']);
if(count($temp) == 2){
$sql .= "and p.price >=".$temp[0]." and p.price <=".$temp[1]. " ";
}
}
if($condition['ll']){
$temp = array();
$temp = explode(",",$condition['ll']);
if(count($temp) == 2){
$temp[0] = date("Y",strtotime("-".$temp[1]." years"));//这里大的反而小,小的反而大
$temp[1] = date("Y",strtotime("-".$temp[0]." years"));
$sql .= "and buildingYears >= ".$temp[0]."";
}
}
if($condition['dt'] == 'Y'){//地铁
$sql .= " and hasMetro = 1";
}
if($order=='default'){
$sql .= "ORDER BY orderBy desc";
}
if($order=='pricedesc'){
$sql .= "ORDER BY p.price desc";
}
if($order=='priceasc'){
$sql .= "ORDER BY p.price asc";
}
$sql .= " limit $PageClass->firstRow,$PageClass->listRows";
$data=$this->query($sql);
价格
区域
商圈
地铁
搜索结果
结果
搜索
查询
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
中智农互联网科技
天津市摩尔互联网科技
河南云网互联网络科技有限公司
新华互联网科技学院
互联网核心科技是什么
互联网科技战争
深圳互联网科技公司
互联网金融 科技金融
平安科技 互联网
亿策互联网科技
深圳齐家互联网科技
智慧科技互联网
时间互联网络科技
无锡溥仪互联网科技有限公司
哈尔滨秒房互联网科技有限公司
哈尔滨新华互联网科技学院
互联网金融中的现代科技
中天科技中国工业互联网
容联科技互联网电商
版纳互联网科技选哪家
中智农互联网科技
深圳九邦互联网科技有限公司
互联网 的科技创新
菲比寻常互联网科技
恒银科技与互联网金融
哈尔滨屹滨互联网科技有限公司
互联网科技大赛获奖感言
中和天地互联网科技有限公司
长沙互联网科技
每天都有哪些好的互联网科技