描述:当查询某一条数据的时候,根据后台返回的数据,对复选框进行勾选
--- jsp页面中的复选框
<div id="other">
<input type="checkbox" id="city2" name="city" value="0537"/> 济宁
<input type="checkbox" id="city3" name="city" value="0530"/> 菏泽
<input type="checkbox" id="city4"name="city" value="0539"/> 临沂 <br/>
</div>
<script type="text/javascript">
//城市复选框选中
$(document).ready(function () {
var boxObj = $("input:checkbox[name='city']");
//var citylist = '${citylist}';
var citylist = '${popubBean.city}'; //获取后台传递过来的城市列表数据
var city = citylist.split(','); //以逗号进行分割
for (j = 0; j < boxObj.length; j++) {
for (i = 0; i < citylist.length; i++) {
if (boxObj[j].value == city[i]) { //如果复选框中的值与城市的值一样
boxObj[j].checked = true; //将复选框的状态选中
break;
}
}
}
});
</script>
schedule
double(6,2) DEFAULT NULL COMMENT “…”
double(6,2):第一个参数表示总长度,第二个参数表示几位小数。
......
order by updateTime desc
delete qy,tsp
from t_pictrue_qy qy
inner join t_sort_and_pic tsp
on qy.id=tsp.sapPicId
where qy.id=1563499409795
TRUNCATE TABLE t_fans_record_copy1
TRUNCATE TABLE t_test2
-- 创建测试表
CREATE TABLE `t_test3` (
`id` int(100) NOT NULL AUTO_INCREMENT COMMENT '自增序列 唯一索引',
`openid` varchar(200) DEFAULT NULL COMMENT '微信用户openid',
`phone` varchar(11) DEFAULT NULL COMMENT '绑定手机号',
PRIMARY KEY (`id`)
)
-- 查出所有有重复记录的所有记录
SELECT count(openid)
from t_test2
where openid !=NULL
GROUP BY phone HAVING count(openid)>1;
--
SELECT count(*)
from t_fans_record_copy1
-- 删除重复语句并保留一条数据的SQL
DELETE FROM 表名 WHERE id NOT IN(SELECT * FROM(SELECT id FROM 表名 GROUP BY 分组名)AS b)
-- 更新数据(将\\N 替换成 null)
UPDATE t_test2 set phone = null WHERE phone ='\\N'
-- 查询是否有没有更新成功的
SELECT * FROM t_test2 where phone ='\\N'
-- 条件复制
INSERT into t_fans_record_copy1(
openid,
city,
subscribe_status,
bind_status,
bind_form,
bind_time,
phone
) select openid,
'535',
'cancel',
case when phone is not null then 'binding' else null end,
case when phone is not null then 'general' else null end,
case when phone is not null then now() else null end,
phone from t_test2
-- 全复制
INSERT into t_fans_record
(openid,
unionid,
nickname,
headimgurl,
city,
subscribe_status,
subscribe_from,
subscribe_time,
unsubscribe_time,
bind_status,
bind_form,
bind_time,
phone,
sex,
wechat_id,
referee_openid,
remark)
SELECT
openid,
unionid,
nickname,
headimgurl,
city,
subscribe_status,
subscribe_from,
subscribe_time,
unsubscribe_time,
bind_status,
bind_form,
bind_time,
phone,
sex,
wechat_id,
referee_openid,
remark
FROM t_fans_record_copy1
--2019年9月4日23:51:28 将一张表的数据更新到另外一张表
UPDATE t_fans_record tr,t_fans_record_xiangtong tx
set tr.subscribe_status=tx.subscribe_status,
tr.subscribe_from=tx.subscribe_from,
tr.subscribe_time=tx.subscribe_time,
tr.unsubscribe_time=tx.unsubscribe_time,
tr.bind_status=tx.bind_status,
tr.bind_form=tx.bind_form,
tr.bind_time=tx.bind_time,
tr.phone=tx.phone,
tr.sex=tx.sex,
tr.referee_phone=tx.referee_phone,
tr.county=tx.county
WHERE tr.openid=tx.openid and tr.city=tx.city
case when 条件 then 值 else 值2 end