2014年11月26日

去重的sql

摘要: DELETEFROM`obd_comprehensive_d_1`USING`obd_comprehensive_d_1`,(SELECTDISTINCTMIN(`id`)AS`id`,box_id,data_timeFROM`obd_comprehensive_d_1`GROUPBY`box_id... 阅读全文

posted @ 2014-11-26 00:17 蓝梦星空 阅读(134) 评论(0) 推荐(0)

2014年10月31日

连表更新

摘要: update op_claims2 a, op_car_owner b set a.licenseno=b.carnumwhere a.engineid =b.engineid and a.chassisid=b.chassisid; 阅读全文

posted @ 2014-10-31 17:26 蓝梦星空 阅读(134) 评论(0) 推荐(0)

日期格式化sql

摘要: select STR_TO_DATE( date, '%d/%m/%Y') date ,engineid,carnumfrom op_car_owner where STR_TO_DATE( date, '%d/%m/%Y')!='' 阅读全文

posted @ 2014-10-31 17:25 蓝梦星空 阅读(130) 评论(0) 推荐(0)

进行日期格式化的sql

摘要: select STR_TO_DATE( date, '%Y-%m-%d') date ,engineid,carnum from op_car_owner 阅读全文

posted @ 2014-10-31 17:24 蓝梦星空 阅读(131) 评论(0) 推荐(0)

建索引sql

摘要: select * from op_breakrule where hphm='苏A2GD78'show index from op_car_owner;alter table op_car_owner add index index_chassisid(chassisid) ;drop index ... 阅读全文

posted @ 2014-10-31 17:23 蓝梦星空 阅读(111) 评论(0) 推荐(0)

字符串进行取长处理

摘要: select inNo from new_op_car_owner where inno !=''create table op_car_owner_ageselect 2014-substr(inno,7,4) age ,inNo,engineid,carnumfrom new_op_car_ow... 阅读全文

posted @ 2014-10-31 17:20 蓝梦星空 阅读(164) 评论(0) 推荐(0)

按指定位置进行字符串替换的sql

摘要: select CONCAT(left(user_truename, 1),'*',right(user_truename, 1)),CONCAT(left(user_tel, 3),'*****',right(user_tel, 3)),CONCAT(left(user_platenumber, 2... 阅读全文

posted @ 2014-10-31 17:19 蓝梦星空 阅读(1744) 评论(0) 推荐(0)

去重查询某表中的信息,并删除另一表中的刚刚查出来的信息

摘要: select DISTINCT carnum from new_op_car_ownerdelete from new_op_car_owner where carnum in(select carnum from(select max(carnum) as carnum,count(carnum)... 阅读全文

posted @ 2014-10-31 17:17 蓝梦星空 阅读(103) 评论(0) 推荐(0)

查询某表中的信息根据另一个表中的字段查询

摘要: select * from op_car_owners1where carnum not in (select carnum from op_car_owners2 ) 阅读全文

posted @ 2014-10-31 17:15 蓝梦星空 阅读(205) 评论(0) 推荐(0)

去重的按某个字段进行去重sql

摘要: delete from op_car_owners2 where carnum in(select carnum from(select max(carnum ) as carnum ,count(carnum) as count from op_car_owners2 group by carnu... 阅读全文

posted @ 2014-10-31 17:12 蓝梦星空 阅读(2515) 评论(0) 推荐(0)

导航