<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    分享java帶來的快樂

    我喜歡java新東西

    刪除部分重復字段的記錄

    創(chuàng)建臨時表
    create table tmp_dur as
    select a.shop_id,a.city_id,a.product_id,max(a.id) as mid from 51fanli_tuandh_item as a group by a.shop_id,a.city_id,a.product_id having count(*) > 1

    查詢聯(lián)合表
    SELECT a.shop_id,a.city_id,a.product_id from tmp_dur a , 51fanli_tuandh_item b where a.shop_id = b.shop_id and a.city_id = b.city_id and a.product_id = b.product_id

    刪除重復項目
    delete from 51fanli_tuandh_item
    where 51fanli_tuandh_item.id != (
    SELECT b.mid from tmp_dur b
    where 51fanli_tuandh_item.city_id = b.city_id and 51fanli_tuandh_item.shop_id = b.shop_id and 51fanli_tuandh_item.product_id = b.product_id
    );

    刪除臨時表
    drop tmp_dur;

    添加唯一
    ALTER TABLE  `51fanli_tuandh_item` ADD UNIQUE (
    `shop_id` ,
    `city_id` ,
    `product_id`
    );

    posted on 2011-08-29 17:32 強強 閱讀(413) 評論(0)  編輯  收藏 所屬分類: mysql

    主站蜘蛛池模板: 国产亚洲精品影视在线产品 | 99久久国产免费-99久久国产免费| 视频一区在线免费观看| jizz日本免费| 亚洲一级二级三级不卡| 久久亚洲av无码精品浪潮| 宅男666在线永久免费观看| 99久久99久久精品免费看蜜桃| 小日子的在线观看免费| 一级黄色免费网站| 在线观看亚洲视频| 亚洲成AV人片在WWW| 国产精品亚洲四区在线观看| 亚洲黄色免费电影| 中文字幕人成人乱码亚洲电影| 国产zzjjzzjj视频全免费| 成年女人18级毛片毛片免费观看| 1000部羞羞禁止免费观看视频| 久久久99精品免费观看| 免费一级毛片无毒不卡| 99久久99这里只有免费的精品| 一级做a爰片久久毛片免费陪 | 国产无遮挡又黄又爽免费视频| 无码免费午夜福利片在线| 国产精品久久久亚洲| 亚洲免费视频一区二区三区| 日本卡1卡2卡三卡免费| 四虎国产精品免费永久在线| 91成人免费观看在线观看| 国产精品综合专区中文字幕免费播放 | 亚洲啪AV永久无码精品放毛片| 亚洲乱码一区av春药高潮| 亚洲国产成人在线视频| 亚洲狠狠狠一区二区三区| 亚洲毛片一级带毛片基地| 亚洲国产中文在线视频| 亚洲人色大成年网站在线观看| 亚洲一级黄色大片| 99热亚洲色精品国产88| 四虎必出精品亚洲高清| 亚洲精品无码专区|