關聯表多字段匹配

1. 文件處理:web

cat kyfx_ci_loc_tmp.dat|awk 'BEGIN{FS="|";OFS="|"}{print $1,$7,substr($14,1,6),substr($15,1,6)}'>kyfx_ci_loc.dat

select * into tmp_kyfx_web_account from kyfx_web_account

2.數據入庫:sql

load table dba.kyfx_ci_loc_tmp2(
f_city_id       '|',
f_ci            '|',
f_longtitude_baidu '|',
f_latitude_baidu 0x0a
)
from '/xwtec/tmp_data/kyfx_ci_loc.dat' 
escapes off quotes off with checkpoint on

3.建視圖關聯兩張查詢表的兩個字段來肯定記錄惟一:shell

CREATE VIEW ci_map_baidu2 AS 

SELECT L.city_id,L.mdn_num,L.s_cycle_date,M.f_longtitude_baidu

,M.f_latitude_baidu from  ci_num_data L join kyfx_ci_loc_tmp2 M

on L.city_id=M.f_city_id and L.start_ci=M.f_ci
相關文章
相關標籤/搜索