Dialer_search_sql


(1)
CREATE TEMP TABLE  temp_dialer_search_table AS SELECT * FROM dialer_search WHERE is_visiable=1
(2)
CREATE TEMP TABLE  temp_dialer_search_view AS SELECT _id,vds_contact_id,vds_raw_contact_id,vds_name_id,vds_call_date,vds_call_log_id,vds_call_type,vds_geocoded_location,vds_sim_id,vds_vtcall,vds_phone_number,vds_phone_type,vds_lookup,vds_photo_id,vds_starred,vds_indicate_phone_sim,vds_is_sdn_contact,vds_name,vds_sort_key FROM view_dialer_search

(3)
SELECT _id,vds_contact_id,vds_call_date,vds_call_log_id,vds_call_type,vds_geocoded_location,vds_sim_id,vds_vtcall,vds_indicate_phone_sim,vds_starred,vds_photo_id,vds_phone_type,vds_name,vds_phone_number,vds_lookup,vds_is_sdn_contact FROM (SELECT _id,vds_contact_id,vds_call_date,vds_call_log_id,vds_call_type,vds_geocoded_location,vds_sim_id,vds_vtcall,vds_indicate_phone_sim,vds_starred,vds_photo_id,vds_phone_type,vds_name,vds_phone_number,vds_lookup,vds_is_sdn_contact, vds_raw_contact_id FROM temp_dialer_search_view WHERE vds_call_log_id > 0  ORDER BY vds_call_date ) GROUP BY vds_raw_contact_id ORDER BY vds_call_date DESC








CREATE TEMP TABLE IF NOT EXISTS temp_dialer_search_table AS SELECT _id AS temp_id,name_type AS name_type,raw_contact_id AS temp_raw_contact_id,normalized_name AS normalized_name,search_data_offsets AS search_data_offsets,DIALER_SEARCH_MATCH(normalized_name,search_data_offsets,name_type,'5') AS matched_data_offsets
 FROM temp_dialer_search_table WHERE  DIALER_SEARCH_MATCH_FILTER(normalized_name,search_data_offsets,name_type,'5')







CREATE TEMP TABLE IF NOT EXISTS temp_dialer_search_view AS
SELECT _id,vds_contact_id,vds_raw_contact_id,vds_name,vds_call_date,vds_call_log_id,vds_call_type,vds_geocoded_location,vds_sim_id,vds_vtcall,vds_phone_number,vds_phone_type,vds_lookup,vds_photo_id,vds_starred,vds_indicate_phone_sim,vds_sort_key,vds_name_id,vds_is_sdn_contact, table_number.matched_data_offsets AS matched_data_offsets,
table_name.matched_data_offsets AS matched_name_offsets
FROM
(SELECT *
FROM temp_dialer_search_view
WHERE vds_raw_contact_id
IN (SELECT temp_raw_contact_id FROM temp_dialer_search_table1)) AS temp_base_view

LEFT JOIN temp_dialer_search_table1 AS table_number ON table_number.temp_id = temp_base_view._id AND table_number.name_type = 8
LEFT JOIN temp_dialer_search_table1 AS table_name ON table_name.temp_id = temp_base_view.vds_name_id AND table_name.name_type = 11

ORDER BY vds_raw_contact_id,table_number.name_type,vds_call_date








SELECT _id,vds_contact_id,vds_call_date,vds_call_log_id,vds_call_type,vds_geocoded_location,vds_sim_id,vds_vtcall,vds_indicate_phone_sim,vds_starred,vds_photo_id,vds_phone_type,vds_name,vds_phone_number,vds_lookup,vds_is_sdn_contact,matched_data_offsets,matched_name_offsets FROM temp_dialer_search_view1
ORDER BY vds_call_date ASC,vds_sort_key COLLATE NOCASE
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值