
INSERT into total_score_tmpD(
DepartmentNameEnd, StaffId,
StaffName,
CountPerHour,
SkillScoreDisCount ,
DealCount ,
ValueCount,
ValueCountDisCount
)
SELECT DepartmentName, StaffId,
StaffName,
3600/(Select DealAvgSeconds from deal_name_type where DealId='121300')AVG(DealAvgSeconds/WaitSeconds) ,
Round(3600/(Select DealAvgSeconds from deal_name_type where DealId='121300')avg(DealAvgSeconds/WaitSeconds)/(select Max(SunValue) From total_score_tmp33)(select CAST(OptionValue as decimal) from sys_info WHERE OptionName='工作技能权重'),2),
count(StaffId),
Sum(DealValue),
Round(Sum(DealValue)/(select Max(SunValue) From total_score_tmp44)(select CAST(OptionValue as decimal) from sys_info WHERE OptionName='工作效益权重'),2)
From deal_record
where DepartmentName like concat(DepartmentName2,'%') and DealDateTime BETWEEN STARTDealDateTime and endDealDateTime
group by StaffId;
insert into total_score_tmpc(DepartmentName , StaffId,
StaffName,
ClientNum ,
EvaluateScore ,
EvaluateScoreDisCount)
SELECT DepartmentName, StaffId,
StaffName,
count(StaffId),
Sum(EvaluatePrice),
Round((Sum(EvaluatePrice)/(select Max(SunValue) From total_score_tmp22))(select CAST(OptionValue as decimal) from sys_info WHERE OptionName='服务评价权重'),2)
From evaluate_record
where DepartmentName like concat(DepartmentName2,'%') and EvaluateDateTime BETWEEN STARTDealDateTime and endDealDateTime
group by StaffId;
PHP+Mysql多条件多值查询示例代码:
indexhtml代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 401 Transitional//EN" " <html><head><meta >
打开数据库那就不写了。
前几天刚写了一个。你看下
/ 表结构
CREATE TABLE `lh_categroy` (
`id` int(10) NOT NULL auto_increment,
`parentid` int(6) NOT NULL,
`name` varchar(255) NOT NULL,
`keyword` varchar(255) NOT NULL COMMENT '关键字',
`des` varchar(255) NOT NULL COMMENT '描述',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=44 DEFAULT CHARSET=utf8;
/
/
获得所有栏目排序后的列表
@return array
/
function getAllOrderColumns($id = 0) {
global $columns;
$result = array();
if ($id) $result[$id] = $columns[$id];
foreach ($columns as $column) {
if ($column['parentid'] == $id) {
$column['level'] = 0;
$result[$column['id']] = $column;
getColumns($columns, $column['id'], $result, 1);
}
}
return $result;
}
function getColumns($columns, $cid, &$result, $l = 1) {
foreach ($columns as $c) {
if ($c['parentid'] == $cid) {
$c['level'] = $l;
$result[$c['id']] = $c;
getColumns($columns, $c['id'], $result, $l + 1);
}
}
}
$sql = 'select from lh_categroy';
$query = mysql_query($sql);
while($row = mysql_fetch_assoc($query)){
$columns[]=$row;
}
$fenlei = '';
$fenlei = '<select name="cid" style="width:200px; height:25px;">
<option value="0">请选择分类</option>';
foreach(getAllOrderColumns() as $v){
$v[name] = $v[level] ($v[level]==1 ' |-'$v[name]:' |-'$v[name]) : $v[name];
$fenlei = "<option value='$v[id]'>$v[name]</option>";
}
$fenlei = '</select>';
echo $fenlei;
以上就是关于mysql存储过程实现数据查询与插入全部的内容,包括:mysql存储过程实现数据查询与插入、php mysql 多表分级查询、PHP MYSQL 的多级分类树结构等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)