一.临时表妙用 -- 1.将老库中的mediaid和新库中的regionid对应上,然后插入到临时表中 SELECT * INTO #TempMediaRegion FROM (SELECT ww.C_MEDIA,C_ID FROM [NEWSYS].[LMSData].[dbo].Base_Region right JOIN openquery(CRM, 'select * from T_LOCREGION') ww ON C_CrmID=ww.C_REGION) hh -- 2.将媒体按媒体…
一.去重 1.查询出重复的记录 CREATE TABLE push_log_full_2013_10_30_tmp SELECT * FROM `push_log_full` WHERE time BETWEEN FROM_DAYS(TO_DAYS(NOW()) - 1) AND FROM_DAYS(TO_DAYS(NOW())) AND (imsi, andriodid, time) IN ( SELECT imsi, andriodid, time FROM `push_log_full`…